Show
Ignore:
Timestamp:
03/25/06 22:22:07 (18 years ago)
Author:
jerome
Message:

Ensures that all texts sent by pknotify to a remote pykoticon server
are UTF-8 encoded.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • pykota/trunk/pykota/storage.py

    r2801 r2804  
    646646    def databaseToUserCharset(self, text) : 
    647647        """Converts from database format (UTF-8) to user's charset.""" 
    648         if text is not None : 
    649             try : 
    650                 return unicode(text, "UTF-8").encode(self.tool.getCharset())  
    651             except UnicodeError :     
    652                 try : 
    653                     # Incorrect locale settings ? 
    654                     return unicode(text, "UTF-8").encode("ISO-8859-15")  
    655                 except UnicodeError :     
    656                     pass 
    657         return text 
     648        return self.tool.UTF8ToUserCharset(text) 
    658649         
    659650    def userCharsetToDatabase(self, text) : 
    660651        """Converts from user's charset to database format (UTF-8).""" 
    661         if text is not None : 
    662             try : 
    663                 return unicode(text, self.tool.getCharset()).encode("UTF-8")  
    664             except UnicodeError :     
    665                 try : 
    666                     # Incorrect locale settings ? 
    667                     return unicode(text, "ISO-8859-15").encode("UTF-8")  
    668                 except UnicodeError :     
    669                     pass 
    670         return text 
     652        return self.tool.userCharsetToUTF8(text) 
    671653         
    672654    def cleanDates(self, startdate, enddate) :