wxHtmlWindow and Unicode BOM? Topic is solved

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
benedicte
wxWorld Domination!
wxWorld Domination!
Posts: 1409
Joined: Wed Jan 19, 2005 3:44 pm
Location: Paris, France

wxHtmlWindow and Unicode BOM?

Post by benedicte »

I am using a wxHtmlWindow to display a local HTML file.

The HTML file uses UTF-8 encoding (with byte order mark), and the wxHtmlWindow object displays a glitch at the top of the screen (before my first text).
I suspected this to be the unicode BOM, so I edited the HTML file to save it as UTF-8 without BOM, and the glitch disappeared.

The fact is that I must be able to load UTF-8_with_BOM files.

How to remove this glitch?

I am using wxWidgets 2.6.2 on Windows and Linux/GTK, Unicode builds.
geralds
I live to help wx-kind
I live to help wx-kind
Posts: 186
Joined: Tue Nov 01, 2005 9:22 am
Contact:

Post by geralds »

I think you could load the file into memory first, remove the BOM if present and call SetPage instead of LoadPage.
benedicte
wxWorld Domination!
wxWorld Domination!
Posts: 1409
Joined: Wed Jan 19, 2005 3:44 pm
Location: Paris, France

Post by benedicte »

Quite good idea, but in fact I don't know if wxHtmlWindow really supports UTF-8...

I may have chinese/russian/... characters in my HTML page. I can easily imagine what I will get on screen if they are interpreted as default ANSI codepage :wink:
geralds
I live to help wx-kind
I live to help wx-kind
Posts: 186
Joined: Tue Nov 01, 2005 9:22 am
Contact:

Post by geralds »

UTF-8 displays fine. Just make sure you specify

Code: Select all

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
in the header. (The file I tested also has an XML declaration with encoding="UTF-8" but I don't know if wxHtmlWindow needs this.)
Post Reply