15 |
|
|
16 |
from wxPython.wx import * |
from wxPython.wx import * |
17 |
|
|
18 |
from locale import getlocale |
from locale import getdefaultlocale |
19 |
|
|
20 |
from Thuban import _ |
from Thuban import _ |
21 |
from Thuban.version import versions |
from Thuban.version import versions |
165 |
|
|
166 |
def unicodeToLocale(unicodeStr): |
def unicodeToLocale(unicodeStr): |
167 |
"Function to convert unicode to the user's locale encoding" |
"Function to convert unicode to the user's locale encoding" |
168 |
|
# Under a german windows 2000 getlocale returns an encoding name |
169 |
return unicodeStr.encode(getlocale()[1]) |
# that's not direcly usable (it's missing a "cp" at the beginning). |
170 |
|
# getdefaultlocale does return a usable encoding name so we use that |
171 |
|
# instead. |
172 |
|
locale=getdefaultlocale()[1] |
173 |
|
if locale is None: |
174 |
|
locale = 'iso-8859-15' |
175 |
|
return unicodeStr.encode(locale) |