unset the GIOChannel's encoding before trying to find and parse the XML
2004-02-16 Sven Neumann <sven@gimp.org> * app/config/gimpxmlparser.c (gimp_xml_parser_parse_io_channel): unset the GIOChannel's encoding before trying to find and parse the XML header.
This commit is contained in:
parent
2bb464ad48
commit
bf9fe2e8d3
2 changed files with 15 additions and 4 deletions
|
|
@ -1,3 +1,9 @@
|
|||
2004-02-16 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* app/config/gimpxmlparser.c (gimp_xml_parser_parse_io_channel):
|
||||
unset the GIOChannel's encoding before trying to find and parse
|
||||
the XML header.
|
||||
|
||||
2004-02-15 Michael Natterer <mitch@gimp.org>
|
||||
|
||||
* libgimp/gimpdrawable.c (gimp_drawable_get): warn and return NULL
|
||||
|
|
|
|||
|
|
@ -94,6 +94,8 @@ gimp_xml_parser_parse_file (GimpXmlParser *parser,
|
|||
if (!io)
|
||||
return FALSE;
|
||||
|
||||
g_io_channel_set_encoding (io, NULL, NULL);
|
||||
|
||||
success = gimp_xml_parser_parse_io_channel (parser, io, error);
|
||||
|
||||
g_io_channel_unref (io);
|
||||
|
|
@ -137,7 +139,7 @@ gimp_xml_parser_parse_io_channel (GimpXmlParser *parser,
|
|||
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
|
||||
|
||||
io_encoding = g_io_channel_get_encoding (io);
|
||||
if (io_encoding && strcmp (io_encoding, "UTF-8"))
|
||||
if (io_encoding)
|
||||
{
|
||||
g_warning ("gimp_xml_parser_parse_io_channel():\n"
|
||||
"The encoding has already been set on this GIOChannel!");
|
||||
|
|
@ -147,8 +149,7 @@ gimp_xml_parser_parse_io_channel (GimpXmlParser *parser,
|
|||
/* try to determine the encoding */
|
||||
while (len < sizeof (buffer))
|
||||
{
|
||||
status = g_io_channel_read_chars (io,
|
||||
buffer + len, 1, &bytes, error);
|
||||
status = g_io_channel_read_chars (io, buffer + len, 1, &bytes, error);
|
||||
len += bytes;
|
||||
|
||||
if (status == G_IO_STATUS_ERROR)
|
||||
|
|
@ -162,11 +163,15 @@ gimp_xml_parser_parse_io_channel (GimpXmlParser *parser,
|
|||
|
||||
if (encoding)
|
||||
{
|
||||
if (!g_io_channel_set_encoding (io, encoding, error))
|
||||
if (! g_io_channel_set_encoding (io, encoding, error))
|
||||
return FALSE;
|
||||
|
||||
g_free (encoding);
|
||||
}
|
||||
else
|
||||
{
|
||||
g_io_channel_set_encoding (io, "UTF-8", NULL);
|
||||
}
|
||||
|
||||
while (TRUE)
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in a new issue