From: <ro...@us...> - 2006-07-22 21:16:21
|
Revision: 16539 Author: roast Date: 2006-07-22 14:16:10 -0700 (Sat, 22 Jul 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16539&view=rev Log Message: ----------- xml logger writes the UTF-8 BOM, and xml parser/reader clobbers it Modified Paths: -------------- branches/soc-2006-file-loggers/src/log.c branches/soc-2006-file-loggers/src/util.c Modified: branches/soc-2006-file-loggers/src/log.c =================================================================== --- branches/soc-2006-file-loggers/src/log.c 2006-07-22 18:14:40 UTC (rev 16538) +++ branches/soc-2006-file-loggers/src/log.c 2006-07-22 21:16:10 UTC (rev 16539) @@ -1035,9 +1035,11 @@ if (!data->channel) return 0; g_string_printf(writebuf, + "%c%c%c" "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n" "<chat service=\"%s\" account=\"%s\" version=\"0.3.1-04\"%s>\n" "\t<event time=\"%s\" type=\"logStart\" />\n", + 0xEF, 0xBB, 0xBF, prpl, gaim_account_get_username(log->account), log->type == GAIM_LOG_SYSTEM ? "gaim:logtype=\"system\"" : "", date); Modified: branches/soc-2006-file-loggers/src/util.c =================================================================== --- branches/soc-2006-file-loggers/src/util.c 2006-07-22 18:14:40 UTC (rev 16538) +++ branches/soc-2006-file-loggers/src/util.c 2006-07-22 21:16:10 UTC (rev 16539) @@ -1522,6 +1522,15 @@ GString *loggedby = NULL; gboolean bad_formatting = FALSE; + const char bom_utf8[] = {0xEF, 0xBB, 0xBF, 0}; + + // clobber the UTF-8 BOM + if (c && *c) { + if(!g_ascii_strncasecmp(c, bom_utf8, 3)) { + c+=3; + } + } + while(!bad_formatting && c && *c) { if(*c == '<') { if (*(c+1) == '/') { /* list all expected closing tags */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |