Re: [xml] setting the default charset ?



    xmlParseDocument(ctxt);


It looks as though the problem is within xmlParseDocument, which starts out
with
    start[0] = RAW;
    start[1] = NXT(1);
    start[2] = NXT(2);
    start[3] = NXT(3);
    enc = xmlDetectCharEncoding(start, 4);
    if (enc != XML_CHAR_ENCODING_NONE) {
        xmlSwitchEncoding(ctxt, enc);

xmlDetectCharEncoding looks at those four characters, notices that they are
"<!xm", and
then sets the encoding for the context to be UTF8 (somehow this seems
related to the
classic expression of the american Henry Ford, who once declared "You can
have any
colour you like, as long as it's black") (no offense intended).

I'm not certain of the best solution - perhaps xmlParseDocument should skip
the
detection if ctxt->encoding is non-NULL?

W. Brack
ABC QuickSilver





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]