[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Portability of Lua
- From: William Ahern <william@...>
- Date: Tue, 30 Apr 2013 16:22:45 -0700
On Tue, Apr 30, 2013 at 03:24:30PM -0700, marbux wrote:
> On Tue, Apr 30, 2013 at 5:16 AM, Rob Kendrick <rjek@rjek.com> wrote:
>
> > Also, I'm not sure how well Lua reacts when char is not 8 bits.
>
> This can be problematic absent a library for handling such characters.
> For UTF-8 chars, I've yet to hit a problem using the utf-8.lua library
> with either Lua 5.1.x or 5.2.x.
> <http://www.curse.com/addons/wow/utf8>. Written in pure Lua, it
> provides UTF-8 aware substitutes for string.len, string.sub,
> string.reverse, string.upper, and string.lower. There are other
> solutions. See generally, <http://lua-users.org/wiki/LuaUnicode>.
>
I believe they're referring to DSP systems where CHAR_BIT is very often 16.
This usually doesn't effect string encodings so much as invalidate width
calculations, unsigned overflow, and a host of other stuff that most C
programmers are only vaguely familiar with.
You know it's a lost cause when you see code with `sizeof (char)', although
at least the developer gets props for trying.