T
T
toarugakusei2021-03-21 16:09:51
Python
toarugakusei, 2021-03-21 16:09:51

Problems with encoding in python script how to solve?

Tried to parry the game with Nscripter on Rren'py found on

gidhabe
https://github.com/franckv/nscripter2renpy

When you run the script it gives an error
D:\ren'py games\nscripter2renpy-master\test\ns2ren\src>python parser.py 0.txt > scripts.rpy
Traceback (most recent call last):
  File "parser.py", line 910, in <module>
    parser.tokenize(input.read())
UnicodeDecodeError: 'shift_jis' codec can't decode byte 0x8c in position 3394: illegal multibyte sequence

6057444aa11af368666925.png
as I understand it, this part of the code should check if there are any Japanese characters in the string,
I went to google this problem and that's what I tried
input = open(sys.argv[1], 'r', encoding='sjis')

    input = codecs.decode(sys.argv[1], 'hex')

    input = pd.read_csv(sys.argv[1], encoding= 'unicode_escape')

    input = open(sys.argv[1], 'rb').read().decode('ISO-8859-1')

    input = codecs.open(sys.argv[1], "r", "sjis")

    input = codecs.open(sys.argv[1],"rb",'shift_jisx0213').read()

    input = codecs.open(sys.argv[1],"rb",'cp932').read()

    input = open(sys.argv[1], 'r').decode('shift-jis').encode('utf-8')

    input = codecs.open(sys.argv[1],"r","utf-8")
    
    input = pd.read_csv(sys.argv[1], encoding="cp932")

but none of this works, then I tried to simply delete all the jap characters and still, even after that, an error is generated
if you look at the line on which he swears there is nothing supernatural , I tried to
605746db7497f497118747.pnggosub *regard_update
delete this line, there is still nothing
I hope someone will find the answer
here is the code
https://drive.google.com/file/d/1R2oZUy6i1otegF-Zl...

Answer the question

In order to leave comments, you need to log in

1 answer(s)
Y
Yupiter7575, 2021-03-21
@yupiter7575

This error means that the character 0x8C the script cannot decode. Are you sure you are using the same version of Python that is on github?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question