diff options
Diffstat (limited to 'pgcli/encodingutils.py')
-rw-r--r-- | pgcli/encodingutils.py | 28 |
1 files changed, 0 insertions, 28 deletions
diff --git a/pgcli/encodingutils.py b/pgcli/encodingutils.py deleted file mode 100644 index 279da3a8..00000000 --- a/pgcli/encodingutils.py +++ /dev/null @@ -1,28 +0,0 @@ -import sys - -PY2 = sys.version_info[0] == 2 -PY3 = sys.version_info[0] == 3 - -text_type = unicode if PY2 else str - - -def unicode2utf8(arg): - """ - Only in Python 2. Psycopg2 expects the args as bytes not unicode. - In Python 3 the args are expected as unicode. - """ - - if PY2 and isinstance(arg, unicode): - return arg.encode("utf-8") - return arg - - -def utf8tounicode(arg): - """ - Only in Python 2. Psycopg2 returns the error message as utf-8. - In Python 3 the errors are returned as unicode. - """ - - if PY2 and isinstance(arg, str): - return arg.decode("utf-8") - return arg |