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

encoding issue #155

Closed
Adaptivity opened this issue Nov 25, 2019 · 10 comments · Fixed by #423
Closed

encoding issue #155

Adaptivity opened this issue Nov 25, 2019 · 10 comments · Fixed by #423

Comments

@Adaptivity
Copy link

I'm trying to update russian translation to the latest PZ version but I run into a problem which I can't solve (I remember same issue was here year ago). So what issue is.
Currently all russian .txt files use windows 1251 encoding which can be read by game (text displayed normally). But for some reason files on github are broken (hieroglyphs all the way). I thought well maybe github can't display windows 1251 files but for some reason SOME files displayed normally and some aren't.

For comparison:

  1. https://github.com/TheIndieStone/ProjectZomboidTranslations/blob/master/RU/Challenge_RU.txt this file uses windows 1251 encoding and displayed correctly
  2. https://github.com/TheIndieStone/ProjectZomboidTranslations/blob/master/RU/ContextMenu_RU.txt this file uses same windows 1251 encoding but as you can see some crazy characters appear here.

So question is why this happens? How do I fix it? If you download these files they displayed normally but not in repository. Also, UTF-8 works for github but game won't display them although english files encoded in UTF-8 are displayed correctly. There are no problems in displaying russian symbols in minecraft for example in UTF-8, seems like zomboid needs different encoding for each language.

@Adaptivity
Copy link
Author

@Connall
Copy link
Contributor

Connall commented Nov 28, 2019

The game does use different encoding for different files, due to variety of fonts that we use I believe. I'm honestly not entirely sure why GitHub sometimes has a problem and sometimes does not. However, since it's generally functioning it's something I have not spent much time looking into. I can maybe spend some time in the future figuring out what's going on. Just bigger issues at the moment, you know?

Edit: Though perhaps unifying the encodings would be a good idea to look into to stop file encoding breakages that can be a real pain.

@Adaptivity
Copy link
Author

👍 for unifying encodings. This issue can wait, maybe someone more experienced in github can sort this out

@Connall
Copy link
Contributor

Connall commented Dec 3, 2019

I'll try some experiments in the coming weeks.

@Connall Connall closed this as completed Dec 3, 2019
@Connall Connall reopened this Dec 3, 2019
@Connall
Copy link
Contributor

Connall commented Dec 3, 2019

Was going to close, but maybe best to leave this open as a reminder.

@narrnika
Copy link
Contributor

Just as a reminder that the issue is still relevant - yes, it would be nice to "combine encodings."
Most likely, this would also solve the issue with incorrect operation of functions print() and file:write() (writing in file question marks instead of national characters, which is especially noticeable when trying to save/load sandbox options or skills/appearance of character)

@Faalagorn
Copy link
Contributor

IMHO it would be the best to use Unicode for everything as long as the engine allows it, and if not find out why. Unicode is de facto standard everywhere nowadays and the issue is only with really old machines and that usually can be solved by a software update. Moden Unicode encodings also support all kind of glyphs, including languages that are not yet supported by PZ probably but might be in future.

@Tiax
Copy link
Contributor

Tiax commented Jan 15, 2021

After some experiments: if you add a .gitattributes file with

EN/*.txt text working-tree-encoding=utf-8
DE/*.txt text working-tree-encoding=cp1252
RU/*.txt text working-tree-encoding=cp1251
CN/*.txt text working-tree-encoding=utf-8
...

the Github changesets seem to work fine. You may need to re-encode them to unicode in the git repo but after that it will be fine in any working tree.

@Faalagorn
Copy link
Contributor

After some experiments: if you add a .gitattributes file with

EN/*.txt text working-tree-encoding=utf-8
DE/*.txt text working-tree-encoding=cp1252
RU/*.txt text working-tree-encoding=cp1251
CN/*.txt text working-tree-encoding=utf-8
...

the Github changesets seem to work fine. You may need to re-encode them to unicode in the git repo but after that it will be fine in any working tree.

I didn't test it yet, but if I understand correctly, that would make files appear correctly in repo and in-game? If, so this would solve the problem we have without modification to the game itself, I'll see if that works and if I can make a PR for it. Thanks!

@Tiax Tiax mentioned this issue Jan 16, 2021
@Tiax
Copy link
Contributor

Tiax commented Jan 16, 2021

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

Successfully merging a pull request may close this issue.

5 participants