Changeset 114

Show
Ignore:
Timestamp:
03/22/04 17:22:05 (4 years ago)
Author:
ug
Message:

Encodings fixes

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • 05/devel/kombilo.py

    r111 r114  
    908908        if encoding: 
    909909            try: 
    910                 t = t.decode(encoding).encode('utf-8') 
    911             except ImportError
     910                t = t.decode(encoding, 'ignore').encode('utf-8', 'ignore') 
     911            except
    912912                pass 
    913913             
     
    27072707            if currentEncoding != 'utf-8': 
    27082708                try: 
    2709                     s = sOrig.decode(currentEncoding).encode('utf-8') 
     2709                    s = sOrig.decode(currentEncoding, 'ignore').encode('utf-8', 'ignore') 
    27102710                    cursor = Cursor(s, self.options.sloppySGF.get()) 
    27112711                     
  • 05/devel/v.py

    r106 r114  
    10551055        if self.encoding: 
    10561056            try: 
    1057                 s = s.decode(self.encoding.lower()).encode('utf-8') 
     1057                s = s.decode(self.encoding.lower(), 'ignore').encode('utf-8', 'ignore') 
    10581058            except: 
    10591059                pass         
     
    22332233 
    22342234 
    2235     def openFile(self, path = None, filename = None, encoding = None): 
     2235    def openFile(self, path = None, filename = None, encoding = ''): 
    22362236        """ Read an SGF file given by filename (if None, ask 
    22372237            for a filename). """ 
     
    26152615            for k in self.gameinfoDict.keys(): 
    26162616                try: 
    2617                     self.gameinfoDict[k] = [ x.encode(self.gameinfoDictencoding)\ 
     2617                    self.gameinfoDict[k] = [ x.encode(self.gameinfoDictencoding, 'ignore')\ 
    26182618                                             for x in self.gameinfoDict[k] ] 
    26192619                except: 
     
    26292629        for k in self.gameinfoDict.keys(): 
    26302630            try: 
    2631                 self.gameinfoDict[k] = [ x.encode(self.gameinfoDictencoding)\ 
     2631                self.gameinfoDict[k] = [ x.encode(self.gameinfoDictencoding, 'ignore')\ 
    26322632                                         for x in self.gameinfoDict[k] ] 
    26332633            except: 
     
    26362636 
    26372637 
    2638     def gameinfo(self, data=None, encoding=None): 
     2638    def gameinfo(self, data=None, encoding=''): 
    26392639        """ Open window with the game info of the current game.""" 
    26402640 
    2641         if encoding is None: encoding = self.cursor.encoding 
     2641        if encoding == '': encoding = self.cursor.encoding 
     2642        # FIXME: sollte dies nicht sein: if self.cursor.encoding: encoding = self.cursor.encoding ? 
     2643         
    26422644        if not data and not self.cursor: 
    26432645            return 
     
    26632665            for k in self.gameinfoDict.keys(): 
    26642666                try: 
    2665                     self.gameinfoDict[k] = [x.decode(encoding) for x in self.gameinfoDict[k]] 
     2667                    self.gameinfoDict[k] = [x.decode(encoding, 'ignore') for x in self.gameinfoDict[k]] 
    26662668                except: 
    26672669                    pass