lua-users home
lua-l archive

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


Op Do., 25 Okt. 2018 om 03:58 het Gé Weijers <ge@weijers.org> geskryf:
>
> On my MacOS machine the following character codes match '%s':
>
> "C" locale: 9 10 11 12 13 32
>
> "en_US.UTF-8" locale: 9 10 11 12 13 32 133 160
>
> 133 == NEXT LINE (NEL)
> 160 == NO-BREAK SPACE (NBSP)

Thanks to you and Egor. Egor's I understand: it is an 8-bit character
set. I find your example a little surprising, though. It's not that
way on Ubuntu. Are you using Lua 5.3? Surely single characters in the
range 128-255 are not legal UTF-8?

$ lua
Lua 5.3.5  Copyright (C) 1994-2018 Lua.org, PUC-Rio
> os.setlocale"en_US.UTF-8"
en_US.UTF-8
> for k=0,255 do if string.char(k):match"%s" then io.write(k,' ') end end
9 10 11 12 13 32 >
> utf8.len"The\160quick brown fox"
nil    4