--- In [email protected], "silvermoonwoman2001" <sheri...@...> wrote:
>
> With the help of this page <http://czyborra.com/utf/> I was able
> to make a script that readily generates utf-8 strings directly
> from unicode code points. Works well. Can call this from a for
> loop that appends the result to a string of many, many utf-8
> characters.
> Function ReturnUTF8(c)
> ;c is a code point, e.g., 10400 or FFFF or whatever
> local u
> local point="U"++c
> c=eval("0x"++c)
> if (c < 0x80) do
> u = ?"\x"++win.hex(c)
> elseif (c < 0x800)
> u = ?"\x"++ win.hex (0xC0 | c>>6)
> u++=?"\x"++win.hex(0x80 | c & 0x3F)
> elseif (c < 0x10000)
> u= ?"\x"++win.hex(0xE0 | c>>12)
> u++=?"\x"++win.hex(0x80 | c>>6 & 0x3F)
> u++=?"\x"++win.hex(0x80 | c & 0x3F)
> elseif (c < 0x200000)
> u = ?"\x"++win.hex(0xF0 | c>>18)
> u++=?"\x"++win.hex(0x80 | c>>12 & 0x3F)
> u++=?"\x"++win.hex(0x80 | c>>6 & 0x3F)
> u++=?"\x"++win.hex(0x80 | c & 0x3F)
> endif
> win.debug(point++": "++u)
> quit(esc(u,?+\+))
I would like to reverse the above activity, such that given a series of utf8
bytes that represent a single unicode code point, it will return the code
point. Help?
Thanks,
Sheri