import locale, decimal # Fedora 19 locales utf8_ctype = "fr_FR.utf8" for loc in ('fi_FI', 'fi_FI@euro', 'fi_FI.iso88591', 'fi_FI.iso885915@euro', 'fi_FI.utf8'): locale.setlocale(locale.LC_ALL, loc) loc_encoding = locale.getpreferredencoding(False) locale.setlocale(locale.LC_NUMERIC, loc) locale.setlocale(locale.LC_CTYPE, utf8_ctype) utf8_encoding = locale.getpreferredencoding(False) print("%s numeric (%s) with %s ctype (%s)" % (loc, loc_encoding, utf8_ctype, utf8_encoding)) try: conv = locale.localeconv() except UnicodeDecodeError as err: print("UnicodeDecodeError: %s" % err) else: print(conv) print()