Re: how to handle 026円 character in a string
[
Date Prev][
Date Next][
Thread Prev][
Thread Next]
[
Date Index]
[
Thread Index]
- Subject: Re: how to handle 026円 character in a string
- From: Patrick Rapin <toupie300@...>
- Date: 2010年10月22日 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.