lua-users home
lua-l archive

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


It was thus said that the Great Tom N Harris once stated:
> On 07/01/2011 01:04 AM, "J.Jørgen von Bargen" wrote:
> >/Please/ dont. Then you'll end, where perl is: reading an 1MB file into
> >a string consumes 4MB of memory :-/ . One of the mayor reasons, I've
> >switched to Lua. I'm quite happy with Lua the way it is. A small utf8
> >module and you can do what you like to. Lua's "one char is one byte and
> >Lua doesnt care, if it's ascii or utf8 or utf16be or utf16le in the
> >bytes" is exactly what I want. In perl with every release you have to
> >struggle again, how to get unicode data to be handled.
> >
> 
> Well I was going to try it just for fun. But now I see that Linux 
> doesn't have wfopen, so that's the end of that.

  But Linux *does* have iconv (or at least, all the Linux distributions I've
seen), which handles not only UTF-8, but a whole slew of character sets (on
my home system, 961 different character sets).  Iconv isn't that hard to
use---it's only three functions.  

  In looking up wfopen() (never heard of it before), it appears that all it
does is open the file up in binary mode.  Can you use the regular
fgetc()/fputc() functions?  Or does it have corresponding "w" functions for
those?  

  -spc (Implemented a Lua iconv module, which wasn't that hard)