Re: BUG #4822: xmlattributes encodes '&' twice

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: BUG #4822: xmlattributes encodes '&' twice
Дата
Msg-id 6200.1243276877@sss.pgh.pa.us
обсуждение исходный текст
Ответ на BUG #4822: xmlattributes encodes '&' twice  ("Itagaki Takahiro" <itagaki.takahiro@oss.ntt.co.jp>)
Ответы Re: BUG #4822: xmlattributes encodes '&' twice
Список pgsql-bugs
"Itagaki Takahiro" <itagaki.takahiro@oss.ntt.co.jp> writes:
> =# SELECT xmlelement(name a, xmlattributes('./qa?a=1&b=2' as href), 'Q&A');
>                  xmlelement
> --------------------------------------------
>  <a href="./qa?a=1&amp;b=2">Q&A</a>
> (1 row)

> '&' in xmlattributes seems to be encoded twice.

This was apparently broken by Peter's patch here:
http://archives.postgresql.org/pgsql-committers/2009-04/msg00124.php

map_sql_value_to_xml_value() performs mapping of & (and various other
special characters), and evidently xmlTextWriterWriteAttribute() does
it again.

I'm not sure about the most appropriate solution.  The libxml2
documentation is so awful that it doesn't even tell you that
xmlTextWriterWriteAttribute does that, let alone suggest whether there
is another API function that doesn't.  We might have to add a bool flag
to map_sql_value_to_xml_value() to enable or disable mapping of special
characters.

            regards, tom lane

В списке pgsql-bugs по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: BUG #4823: problems downloading
Следующее
От: andri rahman hakim
Дата:
Сообщение: bug postgresql version 1.8.4