Skip to content

COMPAT: unicode compat issue fix (GH4854) #4856

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 16, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions pandas/compat/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,8 @@ class to receive bound method

def u(s):
return s
def u_safe(s):
return s
else:
string_types = basestring,
integer_types = (int, long)
Expand All @@ -190,6 +192,12 @@ def u(s):
def u(s):
return unicode(s, "unicode_escape")

def u_safe(s):
try:
return unicode(s, "unicode_escape")
except:
return s


string_and_binary_types = string_types + (binary_type,)

Expand Down
2 changes: 1 addition & 1 deletion pandas/io/pytables.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
import pandas.core.common as com
from pandas.tools.merge import concat
from pandas import compat
from pandas.compat import u, PY3, range, lrange
from pandas.compat import u_safe as u, PY3, range, lrange
from pandas.io.common import PerformanceWarning
from pandas.core.config import get_option
from pandas.computation.pytables import Expr, maybe_expression
Expand Down