[xml] xmlEncodeEntitiesReentrant



Hi,

I'm using xmlEncodeEntitiesReentrant to encode some strings to proper xml strings.
Now I noticed that double quotes are not quoted correcly.
I downloaded the source of libxml2-2.7.8 and looked in the xmlEncodeEntitiesReentrant function.

There I see:(line 584)
/*
     * By default one have to encode at least '<', '>', '"' and '&' !
     */
    if (*cur == '<') {
        *out++ = '&';
        *out++ = 'l';
        *out++ = 't';
        *out++ = ';';
    } else if (*cur == '>') {
        *out++ = '&';
        *out++ = 'g';
        *out++ = 't';
        *out++ = ';';
    } else if (*cur == '&') {
        *out++ = '&';
        *out++ = 'a';
        *out++ = 'm';
        *out++ = 'p';
        *out++ = ';';
    } else if (((*cur >= 0x20) && (*cur < 0x80)) ||
        (*cur == '\n') || (*cur == '\t') || ((html) && (*cur == '\r'))) {
        /*
         * default case, just copy !
         */
        *out++ = *cur;
    }


It seems the comment says " char must be quoted, but the code is not there ?
Or am I doing something wrong ?

Thx,
Jeroen





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