3dstools icon indicating copy to clipboard operation
3dstools copied to clipboard

msbt.py Using a MSBT containing CJK unicode characters leads to UnicodeEncodeError: 'ascii' codec can't encode character in position

Open schrmh opened this issue 2 years ago • 0 comments

When runniny msbt.py with python2, I get the following error on chinese, japanese and korean variants of the menu_msbt.lz (which is effectively a MsgStdBn/MSBT file) files which of the respective regional 3DS Home Menus. Example error for one of those regions:

Traceback (most recent call last):
  File "msbt.py", line 624, in <module>
    msbt.to_json(args.json)
  File "msbt.py", line 189, in to_json
    json.dump(output, open(filename, 'w'), indent=2, sort_keys=True, ensure_ascii=False)
  File "/usr/lib/python2.7/json/__init__.py", line 190, in dump
    fp.write(chunk)
UnicodeEncodeError: 'ascii' codec can't encode characters in position 9-13: ordinal not in range(128)

After that error, the output .json looks like this:

{
  "strings": {
    "lau_1b_make_folder": 

schrmh avatar Jul 30 '23 10:07 schrmh