Ah, I see the problem ... The pattern definitions in the XML locale data files are wrong and have that bizarre character hard coded in.
Is there documentation on these patterns? What would I have to put in that pattern to get the symbol to show up? I'm thinking I'll just setup my own XML locale definition files until this is fixed at the source ... But then if I do that I suppose I can hardcode the $ sign! :) Thanks, J.F. -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Doyon, Jean-Francois Sent: December 22, 2006 10:23 AM To: zope3-users@zope.org Subject: [Zope3-Users] Problem with zope.i18n.locales, currency formatting,and encodings Hello, I'm using the Zope 3 in Zope 2.10 ... (So Zope 3.3 I think?). I'm trying to use the locales package to format currency (and other numbers) into locale sensitive strings. I've figured out the API: >>> from zope.i18n.locales import locales locale = >>> locales.getLocale('en', 'CA') formatter = >>> locale.numbers.getFormatter('currency') >>> formatter.format(29.95) u'\xa429.95' >>> locale.numbers.currencies['CAD'].symbol u'$' The problem is that bizarre encoding: \xa4 ... The dollar sign being standard 7-bit ascii, I'm not sure why it gets encoded this way ... And the symbol definition itself IS correct! In my ZPT that symbol looks like something of a star with a circle in the middle ... Nothing anywhere near a dollar sign :) I've tried some decode/encode options, but to no avail: >>> cs.decode() Traceback (most recent call last): File "<stdin>", line 1, in ? UnicodeEncodeError: 'ascii' codec can't encode character u'\xa4' in position 0: ordinal not in range(128) >>> cs.encode('latin1') '\xa429.95' >>> cs.encode('utf-8') '\xc2\xa429.95' >>> cs.encode('utf-8').decode() Traceback (most recent call last): File "<stdin>", line 1, in ? UnicodeDecodeError: 'ascii' codec can't decode byte 0xc2 in position 0: ordinal not in range(128) What am I missing here? Thanks, Jean-François Doyon Internet Service Development and Systems Support / Spécialiste de dèveloppements internet et soutien technique Canada Centre for Remote Sensing/Centre Canadien de télédétection Natural Resources Canada/Ressources Naturelles Canada http://atlas.gc.ca Tel./Tél.: (613) 992-4902 Fax: (613) 947-2410 _______________________________________________ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users _______________________________________________ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users