| changeset 155 | f436e2fef076 |
| parent 154 | 8cb89c153140 |
| parent 153 | e4746a10edf5 |
| child 156 | 6d447220fd1e |
--- a/src/cm/utils/string.py Fri Feb 05 18:43:58 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,15 +0,0 @@ -import chardet - -def to_unicode(input): - if type(input) == str: - res = None - for encoding in [chardet.detect(input)['encoding'], 'utf8', 'latin1']: - try: - res = unicode(input, encoding) - break; - except UnicodeDecodeError: - pass - if not res: - raise Exception('UnicodeDecodeError: could not decode') - return res - return input \ No newline at end of file