Changeset 113
- Timestamp:
- 03/25/06 23:00:29 (19 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
pykoticon/trunk/bin/pykoticon
r112 r113 111 111 values = {} 112 112 for (k, v) in varvalues.items() : 113 values[k] = v.data113 values[k] = self.frame.UTF8ToUserCharset(v.data) 114 114 wx.CallAfter(self.frame.askDatas, [ self.frame.UTF8ToUserCharset(v.data) for v in labels ], \ 115 115 varnames, \ 116 [ self.frame.UTF8ToUserCharset(v.data) for v in values])116 values) 117 117 # ugly, isn't it ? 118 118 while self.frame.dialogAnswer is None : … … 338 338 self.charset = charset 339 339 self.port = localport 340 self.server = MyXMLRPCServer(self, printserver, localport )340 self.server = MyXMLRPCServer(self, printserver, localport, debug=True) 341 341 342 342 def UTF8ToUserCharset(self, text) : … … 345 345 try : 346 346 return unicode(text, "UTF-8").encode(self.charset) 347 except UnicodeError:347 except (UnicodeError, TypeError) : 348 348 try : 349 349 # Incorrect locale settings ? 350 350 return unicode(text, "UTF-8").encode("ISO-8859-15") 351 except UnicodeError : 352 pass 351 except (UnicodeError, TypeError) : 352 try : 353 return text.encode(self.charset) 354 except (UnicodeError, TypeError, AttributeError) : 355 pass 353 356 return text 354 357 … … 358 361 try : 359 362 return unicode(text, self.charset).encode("UTF-8") 360 except UnicodeError:363 except (UnicodeError, TypeError) : 361 364 try : 362 365 # Incorrect locale settings ? 363 366 return unicode(text, "ISO-8859-15").encode("UTF-8") 364 except UnicodeError : 365 pass 367 except (UnicodeError, TypeError) : 368 try : 369 return text.encode("UTF-8") 370 except (UnicodeError, TypeError, AttributeError) : 371 pass 366 372 return text 367 373