[webkit-qt] Unable to enforce charset for decoding an Html document

Sharma, Ashish ashish.sharma3 at hp.com
Fri Nov 18 03:45:03 PST 2011


Hi all,

Any suggestions for the problem described below ?

Thanks
Ashish


-----Original Message-----
From: webkit-qt-bounces at lists.webkit.org [mailto:webkit-qt-bounces at lists.webkit.org] On Behalf Of Sharma, Ashish
Sent: Thursday, November 17, 2011 7:11 PM
To: webkit-qt at lists.webkit.org
Subject: [webkit-qt] Unable to enforce charset for decoding an Html document

Hi,

I use qt web kit api to convert html files to pdf.

The problem that I am facing is of character corruption of south east asian characters.

Right now I am manually setting the character set for the html files in following way:

	QWebSettings objWebSettings = objQWebPage.settings();
	objWebSettings.setDefaultTextEncoding("GB18030");

but the above code fails for html files of the following type:

<html>
<head>
</head>
<body class='hmmessage'><div dir='ltr'>
<br><br><div><hr id="stopSpelling">From: sunbeam_is_me at hotmail.com<br>To: sunbeam0606 at gmail.com<br>Subject: <br>Date: Thu, 10 Nov 2011 14:53:17 +0800<br><br>

<meta http-equiv="Content-Type" content="text/html; charset=unicode">
<meta name="Generator" content="Microsoft SafeHTML">
<style>
.ExternalClass .ecxhmmessage P
{padding:0px;}
.ExternalClass body.ecxhmmessage
{font-size:10pt;font-family:Tahoma;}

</style>

<div dir="ltr">
逆势大;你是我的阿</div></div></div></body>
</html>

To me it looks like the webkit engine gives precedence to the 'meta' header that specifies the charset and ignores the encoding passed by me.

Is there a way I can enforce my encoding on webkit engine?

Thanks
Ashish
_______________________________________________
webkit-qt mailing list
webkit-qt at lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-qt


More information about the webkit-qt mailing list