-
Notifications
You must be signed in to change notification settings - Fork 519
Description
I encountered this issue when I attempt to open cp949 encoded file. I think same issue would occur with shift-jis encoded file and these can be easily reproduced.
'utf-8' codec can't decode byte 0xc0 in position ~
The problem is in backend.py:read_file
method. In here, it attempts to read source file with default open()
method, which reads file as unicode by default. Exception occurs when file is not in unicode. I think codecs.open
with correct encoding option is necessary. correct encoding shall be passed with gdbgui parameter or use session environment variable.
Currently I modified backend.py:689
line to set encoding from my environment variable and no problem.
...
sys_enc = os.getenv('LC_ALL', 'utf-8')
with codecs.open(path, "r", encoding=sys_enc) as f:
...
Environments are,
Ubuntu 14.04
gdbgui 0.13.2.0 (downloaded from pip)
gdb 8.2
firefox 66.0.3
Thanks.
ps. Fixed error message as previous one was incorrect.