lua-users home
lua-l archive

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


Hi,

On Feb 17, 2014, at 16:55 , steve donovan wrote:

On Mon, Feb 17, 2014 at 5:51 PM, René Rebe <rene@exactcode.de> wrote:
I just noticed that io:lines() does not cope with \0 in the lines, and thus
just returns truncated lines (lua-5.2.3, but legacy 5.1 likewise).

This is not surprising.  The whole idea of 'lines' only really applies
to text files, at least in my head ;)

well, in my option library foundations should just work, and not silently discard some bits and bytes. A line is a line, no matter how many \0 are in there until the next \n-newline. And the Lua manual points out Lua strings are \0-save.

I already provided patches a year or two ago for other pattern matching \0 fixes, which where merged into 5.2.

One quite simple and obvious use of lines with \0 binary data is parsing MIME, CGI data.

René

-- 
 ExactCODE GmbH, Jaegerstr. 67, DE-10117 Berlin
 http://exactcode.com | http://exactscan.com | http://ocrkit.com | http://t2-project.org | http://rene.rebe.de