Mercurial > dive4elements > river
comparison flys-backend/contrib/shpimporter/utils.py @ 4887:1f6e544f7a7f
Importer: Use cp1252 instead of latin-9 to guess filename encodings
author | Andre Heinecke <aheinecke@intevation.de> |
---|---|
date | Mon, 28 Jan 2013 12:45:41 +0100 |
parents | b457532dae63 |
children | c0a58558b817 |
comparison
equal
deleted
inserted
replaced
4886:8e99d2d9364d | 4887:1f6e544f7a7f |
---|---|
27 Returns a valid UTF-8 encoded unicode object or throws a UnicodeDecodeError | 27 Returns a valid UTF-8 encoded unicode object or throws a UnicodeDecodeError |
28 """ | 28 """ |
29 try: | 29 try: |
30 return unicode.encode(unicode(path, sys.getfilesystemencoding()), "UTF-8") | 30 return unicode.encode(unicode(path, sys.getfilesystemencoding()), "UTF-8") |
31 except UnicodeDecodeError: | 31 except UnicodeDecodeError: |
32 # Probably Windows iso-8859-x names so lets try again | 32 # Probably European Windows names so lets try again |
33 return unicode.encode(unicode(path, "iso-8859-15"), "UTF-8") | 33 return unicode.encode(unicode(path, "cp1252"), "UTF-8") |