
(I'm pretty sure my logic is failing in the base64 conversion.)
1) LSL integers are 32 bits or 4 bytes long.
2) By running llBase64ToInteger(llStringToBase64(char)), where char is a single UTF8 character, I should get an accurate bit-for-bit translation unless the character is over 4 bytes long (which is unlikely).
3) Testing each byte's high bit should tell me how many bytes are in the string.
This is the basic logic of what I'm doing for a single character, but it's not even close to working (assuming the string s is >= 1 character long):
string char = llGetSubString(s, 0, 0); // Get the first character.
integer ichar = llBase64ToInteger(llStringToBase64(char)); // Get the byte-for-byte translation of the char, like casting to an int would do in C.
integer size = 1;
while ((ichar = ichar >>
& 0x80)••• size++;
// Now size should give the number of bytes in the character.
I have a suspicion that having no unsigned integers has something to do with why this isn't working--as well as the base64 conversions. Any thoughts?
