Log in

View Full Version : Problem with use of diacritics in lua-generated text



cscase
May 17th, 2014, 18:04
Hey all,
I'm trying to write an extension that translates to another language. Using a string file and textres= for this works great for most things, but my skill names all come over from a table in a lua script, and that seems to be a problem. If I just put diacritics directly in that script, they appear on the sheet as funny characters.

Okay, I thought, it's because I don't have the file encoded as UTF-8. So I switched the encoding, but then FG gave an error message that I interpreted to mean "I don't know how to properly read this file now."

So, next I tried manually using escape sequences in the lua script to get the special characters in. That, too, comes across as the same set of funny characters.

For skill names, because they are coming from a table in lua which is used to populate a windowlist, I can't just straight set a string resource for each skill. But is there a way to dynamically set the textresource for a control to use? Maybe I could do that with a script? I'm not seeing in the reference material a function like that, but maybe I am not looking in the right place.What is the best way to tackle this problem?

Thanks!

Scott

Moon Wizard
May 18th, 2014, 02:14
FG only supports single-byte character encoding, and all the fonts are generated using ISO-8859-1 encoding. All your XML and Lua files should be saved using ISO-8859-1 encoding.

Regards,
JPG

cscase
May 18th, 2014, 04:52
After it failed to work initially, I did set the encoding back to what it was at initially. I think Notepad++ calls it "UTF-8 w/o BOM." That seems to read okay, but FG still does completely random things with any characters with diacritics. On the other hand, it does okay when I have those characters in XML files, like in my strings file defining the testres stuff.

So, is this a case of "Forget it, it's not going to work so don't waste any more time on it"?

Thanks!
Scott

Moon Wizard
May 19th, 2014, 05:38
Try specifically setting the encoding to ISO-8859-1 in Notepad++. (Encoding->Character sets->Western European->ISO-8859-1)

Not all diacritic marks are supported in this encoding, but no single encoding will solve that. It would require a full FG rewrite to support anything other than single-byte encoding. (such as Unicode) Surprising, since the original FG was written by a Finnish team.

Cheers,
JPG

cscase
May 20th, 2014, 05:11
Aha! Thank you, sir. That seems to have done the trick!

Thanks once again!
Scott