Accented letters returning invalid character

6

Well, I realized that in Lua, it is not possible to use letters with an accent.

print("á")

Returns an invalid character. Is there any way to avoid this?

    
asked by anonymous 27.10.2014 / 04:59

1 answer

10

Totally possible, but you need to set the appropriate locale. For this you can use the os.setlocale (locale \[, category\]) function that will define the locale for the program:

Example:

os.setlocale("pt_PT")

or

os.setlocale("pt_PT.iso88591")

You can see the example in the Ideone .

If none is set, the system is used.

    
27.10.2014 / 08:04