Commit 27cb4fc6 by kice Committed by Tianqi Chen

Fix str decoding error on non-English Windows (#2158)

parent d4f8d20e
......@@ -18,7 +18,11 @@ if sys.version_info[0] == 3:
numeric_types = integer_types + (float, np.float32)
# this function is needed for python3
# to convert ctypes.char_p .value back to python str
py_str = lambda x: x.decode('utf-8')
if sys.platform == "win32":
encoding = 'cp' + str(ctypes.cdll.kernel32.GetACP())
py_str = lambda x: x.decode(encoding)
else:
py_str = lambda x: x.decode('utf-8')
else:
string_types = (basestring,)
integer_types = (int, long, np.int32)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment