diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2013-05-04 14:59:26 -0400 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2013-05-04 14:59:26 -0400 |
commit | 2a99b770ddf144c279ad8b42ad8593b3439cd2de (patch) | |
tree | 669f31c9921dc568fe94d73f31cdc5574062fcb6 /lib/sqlalchemy/util/compat.py | |
parent | 6f82c320b8834761fa9606119a4c2cbc6c3312f1 (diff) | |
download | sqlalchemy-2a99b770ddf144c279ad8b42ad8593b3439cd2de.tar.gz |
- unicode literals need to just be handled differently if they have utf-8
encoded in them vs. unicode escaping. not worth figuring out how to combine
these right now
Diffstat (limited to 'lib/sqlalchemy/util/compat.py')
-rw-r--r-- | lib/sqlalchemy/util/compat.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/sqlalchemy/util/compat.py b/lib/sqlalchemy/util/compat.py index bc7a0fe21..94b35f019 100644 --- a/lib/sqlalchemy/util/compat.py +++ b/lib/sqlalchemy/util/compat.py @@ -46,6 +46,9 @@ if py3k: def u(s): return s + def ue(s): + return s + def b(s): return s.encode("latin-1") @@ -79,6 +82,13 @@ else: return (ord(byte) for byte in buf) def u(s): + # this differs from what six does, which doesn't support non-ASCII + # strings - we only use u() with + # literal source strings, and all our source files with non-ascii + # in them (all are tests) are utf-8 encoded. + return unicode(s, "utf-8") + + def ue(s): return unicode(s, "unicode_escape") def b(s): |