mirror of
https://gitlab.gnome.org/GNOME/gimp
synced 2024-10-21 20:12:30 +00:00
UTF-8 validate all strings and try g_locale_to_utf8() as fallback if it
2002-05-30 Michael Natterer <mitch@gimp.org> * app/xcf/xcf-read.c (xcf_read_string): UTF-8 validate all strings and try g_locale_to_utf8() as fallback if it fails. 2002-05-30 Michael Natterer <mitch@gimp.org> * POTFILES.in: added app/xcf/xcf-read.c
This commit is contained in:
parent
0f8e0a80e9
commit
98849323f3
|
@ -1,3 +1,8 @@
|
|||
2002-05-30 Michael Natterer <mitch@gimp.org>
|
||||
|
||||
* app/xcf/xcf-read.c (xcf_read_string): UTF-8 validate all strings
|
||||
and try g_locale_to_utf8() as fallback if it fails.
|
||||
|
||||
2002-05-30 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* configure.in: check for extra libraries needed for inet_ntoa() and
|
||||
|
|
|
@ -24,6 +24,8 @@
|
|||
|
||||
#include "xcf-read.h"
|
||||
|
||||
#include "libgimp/gimpintl.h"
|
||||
|
||||
|
||||
guint
|
||||
xcf_read_int32 (FILE *fp,
|
||||
|
@ -91,8 +93,29 @@ xcf_read_string (FILE *fp,
|
|||
total += xcf_read_int32 (fp, &tmp, 1);
|
||||
if (tmp > 0)
|
||||
{
|
||||
data[i] = g_new (gchar, tmp);
|
||||
total += xcf_read_int8 (fp, (guint8*) data[i], tmp);
|
||||
gchar *str;
|
||||
|
||||
str = g_new (gchar, tmp);
|
||||
total += xcf_read_int8 (fp, (guint8*) str, tmp);
|
||||
|
||||
if (str[tmp - 1] != '\0')
|
||||
str[tmp - 1] = '\0';
|
||||
|
||||
if (! g_utf8_validate (str, -1, NULL))
|
||||
{
|
||||
gchar *utf8_str;
|
||||
|
||||
utf8_str = g_locale_to_utf8 (str, -1, NULL, NULL, NULL);
|
||||
|
||||
g_free (str);
|
||||
|
||||
if (utf8_str)
|
||||
str = utf8_str;
|
||||
else
|
||||
str = g_strdup (_("(invalid UTF-8 string)"));
|
||||
}
|
||||
|
||||
data[i] = str;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
2002-05-30 Michael Natterer <mitch@gimp.org>
|
||||
|
||||
* POTFILES.in: added app/xcf/xcf-read.c
|
||||
|
||||
2002-05-29 Ole Laursen <olau@hardworking.dk>
|
||||
|
||||
* da.po: Changed translation of redo.
|
||||
|
|
|
@ -197,6 +197,7 @@ app/widgets/gimpwidgets-constructors.c
|
|||
app/widgets/gimpwidgets-utils.c
|
||||
|
||||
app/xcf/xcf-load.c
|
||||
app/xcf/xcf-read.c
|
||||
app/xcf/xcf.c
|
||||
|
||||
modules/cdisplay_gamma.c
|
||||
|
|
Loading…
Reference in a new issue