Changeset 2807 for pykota/trunk/pykota/tool.py
- Timestamp:
- 03/25/06 23:21:46 (19 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
pykota/trunk/pykota/tool.py
r2804 r2807 242 242 try : 243 243 return unicode(text, "UTF-8").encode(self.charset) 244 except UnicodeError:244 except (UnicodeError, TypeError) : 245 245 try : 246 246 # Incorrect locale settings ? 247 247 return unicode(text, "UTF-8").encode("ISO-8859-15") 248 except UnicodeError : 249 pass 248 except (UnicodeError, TypeError) : 249 try : 250 return text.encode(self.charset) 251 except (UnicodeError, TypeError, AttributeError) : 252 pass 250 253 return text 251 254 … … 255 258 try : 256 259 return unicode(text, self.charset).encode("UTF-8") 257 except UnicodeError:260 except (UnicodeError, TypeError) : 258 261 try : 259 262 # Incorrect locale settings ? 260 263 return unicode(text, "ISO-8859-15").encode("UTF-8") 261 except UnicodeError : 262 pass 264 except (UnicodeError, TypeError) : 265 try : 266 return text.encode("UTF-8") 267 except (UnicodeError, TypeError, AttributeError) : 268 pass 263 269 return text 264 270