RichTextCtrl, save as html

hello,

if I test the RichTextCtrl in the wxPython demo, 2.8.10.0 unicode

I can insert characters with accentuation,

like é ë (I’m not sure the will be correctly shown after I send this
mail).

But when saving it as html, both IE and Firefox shows these characters
wrong.

After some trial and error, I found that adding the following line into
the html file

the text is both shown well in both IE and Firefox.

As I do don’t understand much of encoding and htlm,

I wonder if this is the correct way ?

And if so, why isn’t that implemented in RichTextCtrl ?

If not, what’s the correct way to get things working correct ?

thanks,

Stef

Stef Mientki wrote:

But when saving it as html, both IE and Firefox shows these characters wrong.

After some trial and error, I found that adding the following line into the html file
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />

the text is both shown well in both IE and Firefox.

As I do don't understand much of encoding and htlm,
I wonder if this is the correct way ?

yes, it is -- you need to specify the encoding to get things to render right. Browsers do often try to guess the correct encoding if there is not one specified, but I guess they didn't succeed in this case.

And if so, why isn't that implemented in RichTextCtrl ?

good question -- when working with unicode (or anything really!), you absolutely need to specify the encoding -- writing html without an encoding is a bug.

-Chris

···

--
Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception

Chris.Barker@noaa.gov

It probably should be. Open a ticket about it at wxTrac.

···

On 1/29/10 3:24 PM, Stef Mientki wrote:

After some trial and error, I found that adding the following line into
the html file
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />

And if so, why isn't that implemented in RichTextCtrl ?

--
Robin Dunn
Software Craftsman

Done,
I thought wxPython was case sensitive:
first I got this message, which I didn't understand at first
   "field component must be set"
should be
   "field Component must be set"
:wink:

Then RichTextCtrl is not in the list,
so isn't that an official Component ?

cheers,
Stef

···

On 01-02-2010 19:35, Robin Dunn wrote:

On 1/29/10 3:24 PM, Stef Mientki wrote:

After some trial and error, I found that adding the following line into
the html file
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />

And if so, why isn't that implemented in RichTextCtrl ?

It probably should be. Open a ticket about it at wxTrac.

I thought wxPython was case sensitive:
first I got this message, which I didn't understand at first
"field component must be set"
should be
"field Component must be set"
:wink:

It says the field should be set, not the field whose label is on your screen as "Component" :wink:

Then RichTextCtrl is not in the list,
so isn't that an official Component ?

It's there in the component list as "wxRichText". It's a C++ class so it doesn't have the leading "wx" stripped off like the Python version of the classes do.

···

On 2/2/10 2:55 PM, Stef Mientki wrote:

--
Robin Dunn
Software Craftsman