Re: [dabo-users] Reenv: Problem in Dabo demo

Author: Nick Raptis

Posted: 2011-05-21 at 08:56:38

Just my 2 cents:

On 05/21/2011 10:02 AM, melkarth0 wrote:

> Finally, it seems that I'm bound to 'latin-1' encoding.

>

I'm starting to think that this is about wx putting a value to keyChar

in your systems default encoding instead of utf-8

> I changed line 56 in dTextBox.py, in onTextKeyChar() section in the demo:

>

> cd, ch = evt.keyCode, evt.keyChar

>

> for this one:

>

> cd, ch = evt.keyCode, unicode(evt.keyChar, 'latin-1')

>

> and now runs fine and logit() displays a beautiful a-acute.

>

> More, unicode(evt.keyChar, 'utf-8') doesn't work.

>

unicode(evt.keyChar, 'latin-1') actually sounds pretty sane.

You just need to dynamically get the default encoding via a property instead of hardcoding it.

I think this is dabo.getEncoding(), so try

unicode(evt.keyChar, dabo.getEncoding())

Most of us don't see this error because our default encoding is utf-8 anyway.

> But, please, if anybody has a better approach, make me know it. I have a

> conceptual confusion with this encodings stuff. For example, if I put the

> line # -*- coding: latin-1 -*- on all the affected demo modules, will it

> works as is?

>

> Greetings

> Melkarth

>

_______________________________________________

Post Messages to: Dabo-users@leafe.com

Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-users

Searchable Archives: http://leafe.com/archives/search/dabo-users

This message: http://leafe.com/archives/byMID/4DD7B686.4080207@otenet.gr

©2011 Nick Raptis