← Back to team overview

spv-dev team mailing list archive

[Branch ~bouf10/slidepresenterview/refactor-pres-design] Rev 66: Try to fix the problem with Unicode comparison using NFC unicode normalization. (3)

 

------------------------------------------------------------
revno: 66
committer: F.-A. Bourbonnais <bouf10pub@xxxxxxxxxxx>
branch nick: refactor-pres-design
timestamp: Mon 2010-05-17 00:03:11 -0400
message:
  Try to fix the problem with Unicode comparison using NFC unicode normalization. (3)
modified:
  slidepresenterview/utils/uri.py


--
lp:~bouf10/slidepresenterview/refactor-pres-design
https://code.launchpad.net/~bouf10/slidepresenterview/refactor-pres-design

Your team SlidePresenterView Development Team is subscribed to branch lp:~bouf10/slidepresenterview/refactor-pres-design.
To unsubscribe from this branch go to https://code.launchpad.net/~bouf10/slidepresenterview/refactor-pres-design/+edit-subscription
=== modified file 'slidepresenterview/utils/uri.py'
--- slidepresenterview/utils/uri.py	2010-05-17 03:50:07 +0000
+++ slidepresenterview/utils/uri.py	2010-05-17 04:03:11 +0000
@@ -117,14 +117,18 @@
     def __cmp__(self, other_uri):
         import unicodedata, sys
         
+        try:
+            encoding = sys.stdout.encoding
+        except:                # Probably not executed by a human...
+            encoding = 'UTF-8' # So assume UTF-8 since our .py are in utf8.
+        
         if not isinstance(other_uri.uri, unicode):
-            other_uri_unicode = unicode(other_uri.uri, 
-                                        sys.getdefaultencoding())
+            other_uri_unicode = unicode(other_uri.uri, encoding)
         else:
             other_uri_unicode = other_uri.uri
             
         if not isinstance(self.uri, unicode):
-            uri_unicode = unicode(self.uri, sys.getdefaultencoding())
+            uri_unicode = unicode(self.uri, encoding)
         else:
             uri_unicode = self.uri