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

msbt.py Using a MSBT containing the reference mark symbol ※ leads to UnicodeEncodeError: 'ascii' codec can't encode character '\u203b'

Open schrmh opened this issue 2 years ago • 0 comments

When runniny msbt.py with python2, I get the following error on a US_English menu_msbt.lz (which is effectively a MsgStdBn/MSBT file) which is part of the american 3DS Home Menu:

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 character u'\u203b' in position 17: ordinal not in range(128)

This character is (reference mark symbol)

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

{
  "strings": {
    "base_2b_cancel": [
      "Back"
    ], 
    "base_2b_newmake": [
      "Create"
    ], 
    "create_bu": [
      "Save-Data Backup"
    ], 
    "dat_bu_notitle": [
      "Could not display"
    ], 
    "dat_bu_sub0": [
      "Select a save location."
    ], 
    "dat_dlg_bu_brkn": [
      "The backup-data management\ninformation is corrupted.\nWould you like to create the\ninformation again?\n\u000e\u0001", 
      "\u0002UBackup-data titles may not be\ndisplayed properly afterward.\u000f\u0001", 
      ""
    ], 
    "dat_dlg_bu_cr0": [
      "The saved backup data\nwill be overwritten.\n\nIs this OK?"
    ], 
    "dat_dlg_bu_cr1": [
      "Saving data...\n\nDo not remove the SD Card\nor turn off the power."
    ], 
    "dat_dlg_bu_cr1_jan": [
      "Saving data...\n\nDo not remove the microSD\nCard or turn off the power."
    ], 
    "dat_dlg_bu_cr1_sac": [
      "Saving data...\n\nDo not remove the microSD\nCard or turn off the power."
    ], 
    "dat_dlg_bu_cr2": [
      "Saved.\n\nSaved backup data can be\nrestored or deleted via\nData Management in\nSystem Settings."
    ], 
    "dat_dlg_bu_crerr": [
      "Data could not be saved."
    ], 
    "dat_dlg_bu_crng": [
      "Failed to create backup-data\nmanagement information."
    ], 
    "dat_dlg_bu_ining": [
      ""
    ], 
    "dat_dlg_bu_iniok": [
      ""
    ], 
    "dat_dlg_bu_init": [
      ""
    ], 
    "dat_dlg_bu_mkext": [
      "Creating backup-data\nmanagement information...\nDo not remove the SD Card\nor turn off the power."
    ], 
    "dat_dlg_bu_mkext_jan": [
      "Creating backup-data\nmanagement information...\nDo not remove the microSD\nCard or turn off the power."
    ], 
    "dat_dlg_bu_mkext_sac": [
      "Creating backup-data\nmanagement information...\nDo not remove the microSD\nCard or turn off the power."
    ], 
    "dat_dlg_bu_nosav": [
      "There is no save data that can\nbe backed up."
    ], 
    "dat_dlg_bu_re1": [
      "Restoring backup data...\nDo not remove the SD Card\nor turn off the power."
    ], 
    "dat_dlg_bu_re1_jan": [
      "Restoring backup data...\nDo not remove the microSD\nCard or turn off the power."
    ], 
    "dat_dlg_bu_re1_sac": [
      "Restoring backup data...\nDo not remove the microSD\nCard or turn off the power."
    ], 
    "dat_dlg_bu_re2": [
      "The save data has been\nrestored from the backup."
    ], 
    "dat_dlg_bu_re3": [
      "The save data has been\nrestored from the backup.\n\n\u000e\u0001"

schrmh avatar Jul 30 '23 09:07 schrmh