Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug|Minor][2.2.16] Some encoding issues with importing localized strings #107

Open
SillyBits opened this issue Nov 4, 2024 · 6 comments

Comments

@SillyBits
Copy link

While playing around with pY, noticed some translations are imported w/ wrong encoding
image

First, I thought of some UI issue, but the preset file shows same string:
image

Localisation in pY itself is correct:
image

@SillyBits SillyBits changed the title [Bug|Minor][2.2.6] Some encoding issues with importing localized strings [Bug|Minor][2.2.16] Some encoding issues with importing localized strings Nov 4, 2024
@Olipro
Copy link
Collaborator

Olipro commented Nov 7, 2024

Hi, could you zip up and attach your preset for this mod? you should find them under Foreman's Presets folder.

It'll be 3 files with the same name, ending in .dat, .json and .pjson respectively.

The JSON file you screenshotted hopefully has the correct data and just needs to be parsed with the correct charset. I can figure it out once I have a copy.

@SillyBits
Copy link
Author

SillyBits commented Nov 7, 2024

pY presets are huge and won't fit as an attachment as a whole, so I've uploaded the .pjson only (which by itself is a 16MB already xD):
pY 2.0.pjson.zip
Line 35806 is a good example, and should be easy to add such to a smaller local preset.

If import itself can't be fixed due to localized_print, fixing at load time sounds good enough for me.

@Olipro
Copy link
Collaborator

Olipro commented Nov 7, 2024

OK, I see. I'd like to try out a few encodings for Foreman to interpret stdout as, starting with UTF8 - are you able to compile Foreman yourself?

If so, add process.StartInfo.StandardOutputEncoding = System.Text.Encoding.UTF8; to line 324 of Foreman\Forms\PresetImportForm.cs (it should go before process.Start();

If not, let me know and I can supply a binary.

I have just tested this myself by manually injecting localised_print('<<<Schrödinger>>>') into the lua script and the change appears to work - however, that's not an authoritative proof, so do please let me know if you need a binary and I can get a PR submitted to resolve this.

@SillyBits
Copy link
Author

SillyBits commented Nov 7, 2024

OK, I see. I'd like to try out a few encodings for Foreman to interpret stdout as, starting with UTF8 - are you able to compile Foreman yourself?

Sure thing, working on a PR in regards to graphs myself atm.
If its just that easy, I can try for myself, will keep you posted ....

@SillyBits
Copy link
Author

This extra line works like a charm:
image

@Olipro
Copy link
Collaborator

Olipro commented Nov 7, 2024

Knowing which code you need to change is 99% of the problem :)

Glad it worked, I'll get a PR submitted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants