lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

Issue #1) ---- Character 160
Lua 5.3 is not recognizing the character 160 / 0xA0 ( as space inside code as space.

When pasting a text from some browsers/text editors, the following text come to my code:
"function(stream, contentType)"

The space that separates "stream," and "contentType" is a Character 160, not Character 32.. Lua do not accept this character as valid space when the content is loaded throught "lua_load" function.

lua_load fails with the following message: :4: <name> or '...' expected near '<\160>'

Issue #2) ----- UTF-8
The same character #160 when encoded as UTF-8 becomes the 2 bytes 0xC2 0xA0.
The 0xC2 character in ISO 8859-1 (Latin-1) codification is the character "Â". What? 

In my app, I strongly advise the users to encode their .lua file as UTF-8 because all of my system function expects utf-8 coding as string parameter

UTF-8 is a growing trend for internationalization, and lua_load should have a parameter that force the engines handle the lua script content as utf-8 encoded. Another sollution is to create lua_loadutf8 function. or... lua_loadutf16 (since UTF-16 is used as standard in many programming languages)

Alysson Cunha / AlyssonRPG - Jogue o tradicional RPG de mesa online