Author: duncan
Date: Tue Dec 26 11:59:39 2006
New Revision: 8809

Added:
   branches/rel-1/freevo/src/sitecustomize.py
Modified:
   branches/rel-1/freevo/src/util/__init__.py

Log:
Added sitecustomize.py to set the default encoding to utf-8
Patched util/__init__.py to try iso-8859-15 when the other Unicode attepts have 
failed.
These patches were supplied by 'harri'


Added: branches/rel-1/freevo/src/sitecustomize.py
==============================================================================
--- (empty file)
+++ branches/rel-1/freevo/src/sitecustomize.py  Tue Dec 26 11:59:39 2006
@@ -0,0 +1,12 @@
+# -*- coding: iso-8859-1 -*-
+# -----------------------------------------------------------------------
+# sitecustomize.py - Automatically imported if present
+# Set the default encoding for freevo to be more 
+# generic that the default ascii. 
+# See http://docs.python.org/lib/module-site.html
+# -----------------------------------------------------------------------
+# $Id$
+
+import sys
+
+sys.setdefaultencoding('utf-8')

Modified: branches/rel-1/freevo/src/util/__init__.py
==============================================================================
--- branches/rel-1/freevo/src/util/__init__.py  (original)
+++ branches/rel-1/freevo/src/util/__init__.py  Tue Dec 26 11:59:39 2006
@@ -46,9 +46,12 @@
                 try:
                     return unicode(string, config.LOCALE)
                 except Exception, e:
-                    print 'Error: Could not convert %s to unicode' % 
repr(string)
-                    print 'tried encoding %s and %s' % (encoding, 
config.LOCALE)
-                    print e
+                    try:
+                        return unicode(string, "iso-8859-15")
+                    except Exception, e:
+                        print 'Error: Could not convert %s to unicode' % 
repr(string)
+                        print 'tried encoding %s and %s' % (encoding, 
config.LOCALE)
+                        print e
         elif string.__class__ != unicode:
             return unicode(str(string), config.LOCALE)
         

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Freevo-cvslog mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog

Reply via email to