How to add a text encoding alias ?
-
wrote on 24 Jul 2012, 10:49 last edited by
Hi
I'm trying to parse html with QtWebkit.
The charset of the html is given by meta tag. ( like below )<meta http-equiv="Content-Type" content="text/html; charset=x-sjis">
( URL: "http://www.kk-bestsellers.com/company/index.htm":http://www.kk-bestsellers.com/company/index.htm )charset is x-sjis as you can know...
The page can not be shown properly since qtwebkit can not find the proper encoding,
but Chrome, IE .. all show well with Shift_JIS.x-sjis is an old presentation of Shift_JIS ( as far as I know )
so I want to add encoding alias from x-sjis to Shift_JIS to qtwebkit.
but I could not find the way..how can I do it ?
thanks in advance :)
-
wrote on 24 Jul 2012, 15:49 last edited by
Is this the only content you have to display? If so you can try to set the default encoding of the entire [[Doc:QWebPage]] or [[Doc:QWebView]]:
@
myWebView->settings()->setDefaultTextEncoding("Shift-JIS");
// or
myWebPage->settings()->setDefaultTextEncoding("Shift-JIS");
@A more elaborate solution would be to create a proxy [[Doc:QTextCodec]] plugin that wraps the Shift-JIS codec. I am not entirely sure that QtWebkit uses QTextCodec for unicode conversions, though.
-
wrote on 27 Jul 2012, 08:35 last edited by
I've read a part of code for encoding.
In my fedora package, it uses Qt unicode.I've a little bit modified and made it parse x-sjis with Shift_JIS.
It works well.but I don't want to edit QtWebKit code itself, I want to control it from my code.
Till now I couldn't find a way.Do you have anything helpful... ??
1/3