On 20/08/2010, at 5:04 PM, ext ari.koivi...@nokia.com wrote:

> Hi,
> 
> I've run into problems in how qml handles character encodings with 
> XMLHttpRequest.
> 
> The web service I'm using returns either a block of text with following 
> response header "content-type: text/plain; charset=iso-8859-1" or a text/xml 
> response with "<?xml version="1.0" encoding="ISO-8859-1" ?>" - depending on 
> the service request.
> 
> I'm using XmlListModel for the XML response and it seems to be working ok 
> with iso-8859-1, but using the responseText with XMLHttpRequest ends up with 
> non-ascii letters in black diamond question marks.
> 
> Looking at the source 4.7.0 beta 2 (qdeclarativexmlhttprequest.cpp):
> ---clip---
> QString QDeclarativeXMLHttpRequest::responseBody() const
> {
>    QXmlStreamReader reader(m_responseEntityBody);
>    reader.readNext();
>    QTextCodec *codec = 
> QTextCodec::codecForName(reader.documentEncoding().toString().toUtf8());
>    if (codec)
>        return codec->toUnicode(m_responseEntityBody);
> 
>    return QString::fromUtf8(m_responseEntityBody);
> }
> ---clip---
> It is trying to find the decoder with the response body and failing as the 
> charset is set in the headers. Shouldn't the header charset be used here?
> 

Thanks, reported as http://bugreports.qt.nokia.com/browse/QTBUG-13117.


_______________________________________________
Qt-qml mailing list
Qt-qml@trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-qml

Reply via email to