Localize and UTF-8?
BlitzMax Forums/MaxGUI Module/Localize and UTF-8?
| ||
I build a "Target.html" file on the fly. Therefore I use a template Utf-8 text file "Source.html" and a UTF-8 text file "Trans.txt" which contains translations. The problem is, that MaxGui.Localization destroys some characters, when it finds and replaces a translation. The czech word passes perfect, when it is "out of " translation or when Localization does not find a corresponding word. But if it finds a translation the result will be with damaged characters. For my test I put already some czech lines into the "Source.html" this is the Trans.txt here is a ZIP with both source files and the resulting file: http://www.blitzforum.de/upload/file.php?id=12326 Function TranslateInfo() Local InStream:TStream , OutStream:TStream, Zeile$ InStream = ReadFile( "Source.html") OutStream = WriteFile( "Target.html") While Eof(InStream)=0 Zeile = ReadLine(InStream) Zeile = LocalizeString(Zeile) WriteLine OutStream, Zeile Wend CloseFile OutStream CloseFile InStream End Function this is the result What do I do wrong? p.s. inside the game the translated words are displayed correct: DrawText "{{Phrase22}}",0,0 |
| ||
What happens when you put the "utf8::" proto in front of your file names? :-p |
| ||
Thank you Brucey, this seems to be the solution. Never heart before about this prefix... Now I do it this way: Function TranslateInfo() Local InStream:TStream , OutStream:TStream, Zeile$ InStream = ReadFile( "utf8::" + "Source.html") OutStream = WriteFile( "utf8::" + "Target.html") While Eof(InStream)=0 Zeile = ReadLine(InStream) Zeile = LocalizeString(Zeile) WriteLine OutStream, Zeile Wend CloseFile OutStream CloseFile InStream End Function But it seems, that I cannot change all file consequent to UTF-8 now. Until now my translation files were WINDOWS-1252 and the TMaxGUILanguage did a good job. Now I tried to save my language-file "german.ini" as UTF-8, then load it as a TMaxGuiLanguage. If I do it this way, I see wrong characters on the screen: Global Language:TMaxGUILanguage Language=LoadLanguage("german.ini") If I do it this way I get a error "Malformed line terminator" on loading: Global Language:TMaxGUILanguage Language=LoadLanguage("utf8::" + "german.ini") What do I do wrong? |