lua-users home
lua-l archive

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


On 06/09/2011 09:16 AM, steve donovan wrote:
Ah, but any plain ASCII is a degenerate (and valid) kind of UTF-8, so
I have the old problem of how to decide:

http://stackoverflow.com/questions/1031645/how-to-detect-utf-8-in-plain-c

Quite apart from the 'plain C' part, the question in my mind is how to
decide when to use the current locate in the MultiByteToUnicode
conversion functions.


Handle it like SciTE, perhaps. Lua can set the encoding for its strings that will be used by all the functions. The default is UTF-8 (though I imagine some users would benefit from CP_ACP). If you need to handle a multi-byte string, do 'winapi.setcodepage(1251)'. And if you support UCS-2 then strings can be passed to and from Windows without conversion.

Just please don't use the BOM.

--
- tom
telliamed@whoopdedo.org