View Issue Details

IDProjectCategoryView StatusLast Update
0000274FreeCADBugpublic2011-02-21 11:11
Reporterwmayer Assigned Towmayer  
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
Product Version0.11 
Target Version0.11Fixed in Version0.11 
Summary0000274: Localization problem with console and UTF-8 strings
DescriptionSee: http://sourceforge.net/apps/phpbb/free-cad/viewtopic.php?f=10&t=790&start=70

App.Console.PrintMessage("test") prints "test"
App.Console.PrintMessage("testé") prints "testé"
App.Console.PrintMessage(u "testé") prints "testé"
App.Console.PrintMessage(u"testé".encode("utf8")) prints "testé"
App.Console.PrintMessage(u"testé".encode("latin1")) prints "testé"
TagsNo tags attached.
FreeCAD Information

Activities

wmayer

2011-02-20 15:56

administrator   ~0000625

Reminder sent to: yorik

Added a bug report due to the printing issue

wmayer

2011-02-21 11:11

administrator   ~0000626

We now always encode the input string as latin1 which (probably) the best trade-off in most cases. Now it gives these results:

App.Console.PrintMessage("test") prints "test"
App.Console.PrintMessage("testé") prints "testé"
App.Console.PrintMessage(u"testé") prints "testé"
App.Console.PrintMessage(u"testé".encode("utf8")) prints "testé"
App.Console.PrintMessage(u"testé".encode("latin1")) prints "testé"

But it always depends on how the input is actually encoded. As you can see
App.Console.PrintMessage(u"testé".encode("utf8")) prints "testé"
is still not what you expect. But u"testé".encode("utf8") returns a str object nota unicode object and FreeCAD encodes this again as UTF-8. So, it's actually in the responsibility of the caller/user to do that right.

Issue History

Date Modified Username Field Change
2011-02-20 15:55 wmayer New Issue
2011-02-20 15:55 wmayer Status new => assigned
2011-02-20 15:55 wmayer Assigned To => wmayer
2011-02-20 15:56 wmayer Note Added: 0000625
2011-02-21 11:11 wmayer Note Added: 0000626
2011-02-21 11:11 wmayer Status assigned => closed
2011-02-21 11:11 wmayer Resolution open => fixed
2011-02-21 11:11 wmayer Fixed in Version => 0.11