xVA-Synth icon indicating copy to clipboard operation
xVA-Synth copied to clipboard

UnicodeDecodeError: 'cp932' codec can't decode byte 0x99

Open TFWol opened this issue 2 years ago • 7 comments

Hello, just reporting server.py errors out when trying to read scripts.js with error:

python server.py
Traceback (most recent call last):
  File "C:\Users\WDAGUtilityAccount\Desktop\_windows sandbox mapped\xVASynth_2\resources\app\server.py", line 16, in <module>
    lines = f.read().split("\n")
UnicodeDecodeError: 'cp932' codec can't decode byte 0x99 in position 45308: illegal multibyte sequence

Basically, it won't run with Japanese locale. I originally tried running the program as normal via xVASynth.exe, but server.exe would just close right away.

  • Logs don't show anything obvious dealing with that error, only app.log is written to app.log

TFWol avatar Dec 10 '21 07:12 TFWol

I should mention, running it on an English locale works as expected.

TFWol avatar Dec 10 '21 08:12 TFWol

Hey. Yes, other locales have to specifically be added in for it to work (I assume you mean you tried to synth a line using japanese characters?). During the voice training stage. I am currently working on expanding the locale support, so keep an eye out for updates.

Out of curiosity, what line did you try to synth?

DanRuta avatar Dec 10 '21 08:12 DanRuta

Unfortunately, I can't even get the program to run the backend server.py (or .exe). The xVASynth.exe interface pops up, but the server process that should pop up on port 8008 never starts up.

Here's a video of what I saw as far as the server.exe goes

https://user-images.githubusercontent.com/9045213/145571317-8190251f-ef28-41ee-98f8-d714aceb1e49.mp4

TFWol avatar Dec 10 '21 12:12 TFWol

Then I tried running it via python which uncovered the real error from my original post

TFWol avatar Dec 10 '21 12:12 TFWol

I had to back out of the directory until the relative path could find the script.js file, but it leads to the same encoding error. server exe codec error

From here https://github.com/DanRuta/xVA-Synth/blob/5d9ec125bfff69f56e12309009f51c78f5b09ca0/server.py#L15-L17

Maybe something along the lines of:

    with open(f'{"./resources/app" if PROD else "."}/javascript/script.js',encoding='utf-8') as f:
       lines = f.read().split("\n")
       APP_VERSION = lines[1].split('"v')[1].split('"')[0]

or have it in a try statement?

It at least was able to get me past the encoding problem for that file.

TFWol avatar Dec 10 '21 12:12 TFWol

Oh right, I thought you meant the issue was caused from the text input, not the source files. Ok, I'll definitely add the explicit encoding, if that fixed it for you. I didn't run into this myself. So where are you at now, did you change the python code, and run it from the dev environment?

DanRuta avatar Dec 10 '21 15:12 DanRuta

I don't have anything setup for a full test due to time. I pretty much did a piecemeal approach and stepped through the code while looking up what the errors meant. I had seen the server could be run directly based on how it was setup so I focused on that with the 5-10 mins I could spare here and there.

After I got past the decode error, using the server.py, it just complained about needed packages that I didn't have since I was using a sandbox (not surprising). Testing server.exe would require building another one to test what happens after that decode error.

The python code has more files that are read which could spawn the same problem, but I can't test at this time.

TFWol avatar Dec 10 '21 18:12 TFWol