[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: how to handle \026 character in a string
- From: Patrick Rapin <toupie300@...>
- Date: Fri, 22 Oct 2010 20:16:32 +0200
I think that the problem comes from the string.format("%q") feature, followed by loadfile.
In Lua 5.1, using %q modifier in string.format escapes the following characters: \" \\ \r \n \0.
All other bytes, including \026, are copied verbatim. But on Windows, there is a problem if the resulting string in written to a file, and run with dofile or loadfile.
This is because ^Z means EOF if the file is opened in text mode, which is the mode used in luaL_loadfile.
In Lua 5.2.0, all control characters are now escaped, so you probably wouldn't see the problem anymore.
I suggest you to patch function "addquoted" in lstrlib.c with the version found in Lua 5.2.0-work4, or simply to add the case 26 in the switch.