diff options
| author | Vik <vmuriart@gmail.com> | 2016-09-12 00:14:01 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2016-09-12 00:14:01 -0700 |
| commit | 47fef6b7cb1fa8edd83dd31eb73aaf3c9afff086 (patch) | |
| tree | cda75d04543a02e20bf04ab01c8dfc5e670a269d /sqlparse/compat.py | |
| parent | 791a3312a247670cdeed61e52e8ca449dbb27afa (diff) | |
| parent | 843499915e91e0ee324a0407c78ac6f570806370 (diff) | |
| download | sqlparse-47fef6b7cb1fa8edd83dd31eb73aaf3c9afff086.tar.gz | |
Merge pull request #287 from phdru/master
Convert string literals to unicode using u() for Py27
Diffstat (limited to 'sqlparse/compat.py')
| -rw-r--r-- | sqlparse/compat.py | 16 |
1 files changed, 2 insertions, 14 deletions
diff --git a/sqlparse/compat.py b/sqlparse/compat.py index d6a9144..933e0be 100644 --- a/sqlparse/compat.py +++ b/sqlparse/compat.py @@ -23,14 +23,10 @@ PY3 = sys.version_info[0] == 3 if PY3: - def u(s, encoding=None): - return str(s) - - def unicode_compatible(cls): return cls - + bytes_type = bytes text_type = str string_types = (str,) from io import StringIO @@ -38,20 +34,12 @@ if PY3: elif PY2: - def u(s, encoding=None): - encoding = encoding or 'unicode-escape' - try: - return unicode(s) - except UnicodeDecodeError: - return unicode(s, encoding) - - def unicode_compatible(cls): cls.__unicode__ = cls.__str__ cls.__str__ = lambda x: x.__unicode__().encode('utf-8') return cls - + bytes_type = str text_type = unicode string_types = (str, unicode,) from StringIO import StringIO |
