[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
r6336 - trunk/gnue-common/src/apps
From: |
johannes |
Subject: |
r6336 - trunk/gnue-common/src/apps |
Date: |
Mon, 20 Sep 2004 01:36:43 -0500 (CDT) |
Author: johannes
Date: 2004-09-20 01:36:41 -0500 (Mon, 20 Sep 2004)
New Revision: 6336
Modified:
trunk/gnue-common/src/apps/i18n.py
Log:
Moved that encoding mapping
Modified: trunk/gnue-common/src/apps/i18n.py
===================================================================
--- trunk/gnue-common/src/apps/i18n.py 2004-09-19 20:10:56 UTC (rev 6335)
+++ trunk/gnue-common/src/apps/i18n.py 2004-09-20 06:36:41 UTC (rev 6336)
@@ -45,6 +45,21 @@
encoding = None
enc_policy = "replace" # policy to use if an unicode character
+# The ENC_MAP dictionary defines a mapping between an encoding retrieved from
+# the locale module and the encoding used by the unicode () function.
+ENC_MAP = {
+ '1250': 'cp1250',
+ '1251': 'cp1251',
+ '1252': 'cp1252',
+ '1253': 'cp1253',
+ '1254': 'cp1254',
+ '1255': 'cp1255',
+ '1256': 'cp1256',
+ '1257': 'cp1257',
+ '1258': 'cp1258',
+}
+
+
# -----------------------------------------------------------------------------
# Find a module from filename
# -----------------------------------------------------------------------------
@@ -154,14 +169,12 @@
"""
This function returns the encoding of the currently active locale
@returns: encoding of the current locale
- """
- enc = locale.getlocale () [1]
- # hack against bogus Python locale modul
- if sys.platform == 'win32' and \
- enc in ('1250', '1251','1252','1253','1254','1255','1256','1257','1258',):
- return 'cp'+enc
+ """
+ enc = locale.getlocale () [1]
+ if ENC_MAP.has_key (enc):
+ return ENC_MAP [enc]
else:
- return enc or 'ascii'
+ return enc or 'ascii'
# -----------------------------------------------------------------------------
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- r6336 - trunk/gnue-common/src/apps,
johannes <=