I'm working on a Unicode converter. So far I have enough that I can emit any
Unicode character. I should have the rest in a week or two; I also have some
work to fit this between.
phma
---
base @ hex
: u>utf8 ( unicode - utf8 )
dup 110000 u>= if
drop -1
else
dup 10000 u>= if
dup 0ffffffc0 and 3 * +
dup 0ffffc000 and 3 * +
dup 0ffc00000 and 3 * +
0f0808080 +
else
dup 800 u>= if
dup 0ffffffc0 and 3 * +
dup 0ffffc000 and 3 * +
0e08080 +
else
dup 80 u>= if
dup 0ffffffc0 and 3 * +
0c080 +
then then then then ;
: uemit ( unicode - )
u>utf8
dup 0ff000000 and 18 rshift ?dup if emit then
dup 0ff0000 and 10 rshift ?dup if emit then
dup 0ff00 and 08 rshift ?dup if emit then
emit ;
base !
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]