STAR TREK 2d20
  1. #1

    Problem with use of diacritics in lua-generated text

    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

  2. #2
    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

  3. #3
    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

  4. #4
    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

  5. #5
    Aha! Thank you, sir. That seems to have done the trick!

    Thanks once again!
    Scott

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
FG Spreadshirt Swag

Log in

Log in