[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Small UTF-8 encoder
- From: Marc Balmer <marc@...>
- Date: Tue, 19 Jun 2012 15:15:34 +0200
Am 19.06.12 14:59, schrieb Patrick Rapin:
> Essentially as an exercise, I tried to write the smaller possible
> UTF-8 encoder in Lua .
> Compared to a naive implementation like in , it is around 2.6 times shorter.
> Still, I am wondering if the code could be further shorted (not
> counting space removal).
>  https://gist.github.com/b0ae016da7b8f0b221ff
>  http://lwn.net/Articles/493167/ (and that implementation doesn't
> handle 4 bytes codes)
Maybe I am cheating a bit, but if write a binding to the FcUcs4ToUtf8()
function from fontconfig, it could be smaller. But then, it is not
implemented in Lua (which you probably want)
int FcUcs4ToUtf8(FcChar32 src);