Home Tutorials Download Beta Store Forum Documentation KnowledgeBase Wiki Blog


Return to Wish list

Script Editor: Save files as UTF-8

You need some features? ask it to us here!

Script Editor: Save files as UTF-8

Postby giggsy » 24 Apr 2012, 08:56

Maybe something for 2.0 :)

We are currently implementing localization, and you can run into trouble if you use UTF-8 text and hardcoded values from within LUA becuause the LUA files are saved in ASCII.

Code: Select all
local hText = hud.getComponent ( hUser, sName..".Text" )
hud.setLabelText ( hText, string.format ( localization.get ( "SomeStringId" ), "~" ) )

- hText is UTF-8 encoded.
- localization.get ( "SomeStringId" ) returns an UTF-8 encoded string, e.g. "You need more %s"
- "~" is our bitmap font symbol for a coin icon

Now this works for the "~", but e.g. not for "§", because that character doesn't appear to be compatible between ASCII & UTF-8 ... and that leads to very strange results.

It would be cool if you could save your lua files in UTF-8!

Questions that occur:
- What would happen if it's the other way around (lua file = UTF-8, hText = ASCII)?
- Do you actually have any big benefits from using ASCII? Shouldn't you just enforce UTF-8?
User avatar
Platinum Boarder
Platinum Boarder
Posts: 1105
Location: Austria

Return to Wish list