[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
r5268 - trunk/gnue-common/src/apps
From: |
jan |
Subject: |
r5268 - trunk/gnue-common/src/apps |
Date: |
Mon, 8 Mar 2004 13:49:31 -0600 (CST) |
Author: jan
Date: 2004-03-08 13:49:30 -0600 (Mon, 08 Mar 2004)
New Revision: 5268
Modified:
trunk/gnue-common/src/apps/i18n.py
Log:
add encoding policy setting and set it to "replace".
Modified: trunk/gnue-common/src/apps/i18n.py
===================================================================
--- trunk/gnue-common/src/apps/i18n.py 2004-03-08 19:22:01 UTC (rev 5267)
+++ trunk/gnue-common/src/apps/i18n.py 2004-03-08 19:49:30 UTC (rev 5268)
@@ -37,6 +37,8 @@
catalogs = {} # Message catalogs by domain
language = None
encoding = None
+enc_policy = "replace" # policy to use if an unicode character
+ # can't be translated to encoding
# -----------------------------------------------------------------------------
# Find a module from filename
@@ -95,7 +97,7 @@
# catalog.gettext (msg) returns a string in the po-file's encoding. We want
# the user's encoding, so we have to convert.
# FIXME: Actually, this function should return unicode values.
- return (catalog.ugettext (msg)).encode (encoding)
+ return (catalog.ugettext (msg)).encode (encoding, enc_policy)
# -----------------------------------------------------------------------------
# Convert Unicode to String, let everything else untouched. This is o().
@@ -103,7 +105,7 @@
def outconv (msg):
if isinstance (msg, UnicodeType):
- return msg.encode (encoding)
+ return msg.encode (encoding, enc_policy)
else:
return msg
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- r5268 - trunk/gnue-common/src/apps,
jan <=