diff --git a/python/tvm/_ffi/base.py b/python/tvm/_ffi/base.py index 0a91c41127e452d56de8261814a72aca1175d507..2579f22e44afff4ea4f69fd34917fdc24fb9a219 100644 --- a/python/tvm/_ffi/base.py +++ b/python/tvm/_ffi/base.py @@ -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)