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