Advertisement
Guest User

Untitled

a guest
Jul 7th, 2015
209
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. string Int2Uni(integer i)
  2. // Totally works with mono. Does NOT work with LSLeditor.
  3. // Can't be 0. Should be in UTF-16 range. No error checking.
  4. // Only works in the 0x0001 thru 0xD7FF range (UTF-16 compatibility).
  5. {
  6. if (i < 0x80) return llUnescapeURL("%" + Byte2Hex(i));
  7. if (i < 0x800) return llUnescapeURL("%" + Byte2Hex((i >> 6) | 0x3FC0) + "%" + Byte2Hex((i | 0x80) & 0xBF));
  8. return llUnescapeURL("%" + Byte2Hex((i >> 12) | 0x1FE0) + "%" + Byte2Hex(((i >> 6 ) | 0x80) & 0xBF) + "%" + Byte2Hex(((i | 0x80) & 0xBF)));
  9. }
  10.  
  11. string Byte2Hex(integer i)
  12. // This just works on integers from 0x00 to 0xFF.
  13. {
  14. return llGetSubString("0123456789abcdef", i = ((i >> 4) & 0xF), i) + llGetSubString("0123456789abcdef", (i & 0xF), (i & 0xF));
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement