getdefault locale

Bernhard Reiter bernhard at intevation.de
Mon Dec 20 10:39:22 CET 2004


On Fri, Dec 17, 2004 at 04:54:25PM +0100, cvs at intevation.de wrote:
> Author: bh

>  def unicodeToLocale(unicodeStr):
>      "Function to convert unicode to the user's locale encoding"
> -
> -    return unicodeStr.encode(getlocale()[1])
> +    return unicodeStr.encode(getdefaultlocale()[1])

BTW:
This code is not robust against getdefaultlocale() returning (None, None), 
which can happen according to the manual.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://www.intevation.de/pipermail/thuban-devel/attachments/20041220/13a4a729/attachment.bin


More information about the Thuban-devel mailing list

This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)