Guest User

Python Script for scraping a shift-jis to unicode table, and then exporting as a lua table.

a guest
Apr 28th, 2026
27
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.98 KB | None | 0 0
  1. from collections import defaultdict
  2. import pandas as pd
  3.  
  4. urls = [r'https://www.fileformat.info/info/charset/Shift_JIS/list.htm',
  5. r'https://www.fileformat.info/info/charset/Shift_JIS/list.htm?start=1024',
  6. r'https://www.fileformat.info/info/charset/Shift_JIS/list.htm?start=2048',
  7. r'https://www.fileformat.info/info/charset/Shift_JIS/list.htm?start=3072',
  8. r'https://www.fileformat.info/info/charset/Shift_JIS/list.htm?start=4096',
  9. r'https://www.fileformat.info/info/charset/Shift_JIS/list.htm?start=5120',
  10. r'https://www.fileformat.info/info/charset/Shift_JIS/list.htm?start=6144'
  11. ]
  12.  
  13. for url in urls:
  14. tables = pd.read_html(url, converters=defaultdict(lambda: str))
  15. characterTable = tables[0]
  16. characters = len(characterTable)
  17. i = 0
  18.  
  19. while i < characters:
  20. print("[0x" + str(characterTable.loc[i]['Encoded Byte']) + ']="' + str(characterTable.loc[i]['Character']) + '", ')
  21. i += 1
  22.  
Advertisement
Add Comment
Please, Sign In to add comment