lua-users home
lua-l archive

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


> But don't use UTF-7. Just don't.

That was an oversight on my part which I fixed in a follow up email.  Part of the reason I sent it to the list was to get this kind of feedback.

> Here you are using "Lua" to mean Lua 5.2 or later. The still widely used Lua 5.1 did not support hex escapes. 

Thats fine, I'm not that interested in old versions, I depend too much on the new features.

> You would be far better served by writing a Lua function that generates a proper C string literal and calling that instead of depending on string.format("%q") and additional processing. 

I have a Lua runtime embedded in another application which I can modify as I see fit, and it's easier for me to extend or tweak existing functionality than write new functions.  I am currently running, I think, 8 modifications from the standard distribution.  I love how "hackable" Lua is.

Occasionally if I have something that I think is either low impact or quite useful I toss it out for feedback and to hope that maybe there's some interest and some of the features work their way into later versions.  I think Lua strings should be serialised as legal UTF-8, and since the hexadecimal or decimal escape formats are both typically going to be 4 characters and the hexadecimal format is more generally compatible it should be preferred.  The strings produced by this patch can still be read back by Lua, but they'll survive travelling through a strict UTF-8 system without being clobbered by 0xFFFD and they're more likely to be compatible with other programming languages too.

Regards,

Duane.