[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: from ascii to hex for unicode char
- From: "Chris Swetenham" <cswetenham@...>
- Date: Fri, 15 Feb 2008 15:47:26 -0000
Try this:
print(string.format("0x%x", utf8.byte("ည",1,-1)))
string.format accepts the same format codes as C printf, and %x prints an
integer as a hex value.
Hope that helps,
Chris Swetenham
----- Original Message -----
From: "Jelle Huisman" <jelle@jhnet.nl>
To: "Lua list" <lua@bazar2.conectiva.com.br>
Sent: Friday, February 15, 2008 3:38 PM
Subject: from ascii to hex for unicode char
Hello,
I try to analyse a unicode character, e.g. "ည". I am able to get the
ascii code for this string using: print(utf8.byte("ည",1,-1))
This gives me 4106, which is correct. However I would like to get the
unicode codepoint in hex notation, for this character this would be:
0x100A How do I get this result? (I use the slnunicode library)
Thanks,
Jelle