class wc3270App(ExecutableAppWin):
executable = 'wc3270'
args = ['-xrm', 'wc3270.unlockDelay: False', '-xrm', 'wc3270.model: 2', '-xrm', 'wc3270.charset: thai']
UnicodeDecodeError: 'utf8' codec can't decode byte 0xc8 in position 12: invalid continuation byte |
em = Emulator(visible=EmuladorVisible, timeout=30, app=None, args=["-model", "3279-2", "-charset", "spanish-euro"])
The only way I have found to solve it is by modifying the library ... I know it's not a very "elegant" solution but I didn't find another way
lines 413 and 455 from file __init__.py modify enconding from "ascii" to "latin-1" in my case
413 self.exec_command('String("{0}")'.format(tosend).encode("latin-1"))
455 return cmd.data[0].decode("latin-1")
cmd = self.exec_command('ascii({0},{1},{2})'.format(ypos, xpos, length).encode("ascii"))
# this usage of utf-8 should only return a single line of data
assert len(cmd.data) == 1, cmd.data
buildin_str = _Converter()
string_str = String()
str_r = cmd.data[0]
str_byte = buildin_str.convert_to_bytes(str_r)
str_uni = string_str.decode_bytes_to_string(str_byte, "ISO-8859-11")
return str_uni
Hi, i found similar problem in Spanish characters.