Click here to Skip to main content
15,846,726 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
In the "Knytt Underground" game written in Python, ini files are used with English dialogue text (key = value - value is some dialogue phrase), when I entering the Polish character eg. ęąćź displays '?'

What I have tried:

I tried to type escape character

.ini
\x119
\u119


But it s not working. Game single backslash \ reads as a line break (only \ without the letter 'n') I checked the ttf file in game folder(Ubuntu-Mono Regular.ttf) and it supports Polish letters So how do you save Polish letters (Unicode characters) in ANSI(propably) ini files?
Posted
Updated 6-Jul-22 2:59am
v3

1 solution

You need to change the file to UTF-8 or Unicode so it can keep the Polish characters. Notepad has options to convert it to a different encoding on the Save As option.

I finally figured out how to write and read those characters in Python. However, it requires the code to specify encoding='utf-8' when reading the file. So you need to take this up with the writers of the game, as they will need to change their code.
 
Share this answer
 
v2
Comments
Member 11228769 17-Jan-22 6:55am    
Unfortunately that doesn't help, .ini files already have UTF-8 encoding set when I open them in notepad. "??" is displayed and the backslash disappears and takes you to the next line of text
Richard MacCutchan 17-Jan-22 6:59am    
I do not think notepad understands escape sequences. But when I paste name=ęąćź it displays correctly.
Member 11228769 17-Jan-22 7:21am    
Yes, polish letters in notepad displays correctly ęąźćś, but in game not '????'
Richard MacCutchan 17-Jan-22 8:04am    
I have tried a number of things but Python still writes the characters in a different encoding. Unfortunately even changing locale to 'Polish' does not fix it.
Richard MacCutchan 17-Jan-22 10:45am    
I finally figured out how to write and read those characters in Python. However, it requires the code to specify encoding='utf-8' when reading the file. So you need to take this up with the writers of the game, as they will need to change their code.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900