I've got a string that's been passed to Director, which is encoded with UTF8
but as far as Director is concerned is just a string of ANSI characters. Now
I want to pass the string to Flash and have Flash interpret it as a Unicode
string. I've written my own UTF8 decoder function, but unfortunately, I've
got a problem somewhere. I'm trying hard to pin it down to a single issue,
but I think the problem is that String.fromCharCode() and
String.charCodeAt() use Unicode rather than ANSI. So the process is:
Director reads a piece of text encoded as a binary string. It turns it into
a sequence of bytes.
It reads, say, the byte 142. It turns it into the character "Ž" (under my
local ANSI codepage)
It passes that to Flash. Flash then runs String.charCodeAt() to turn this
back into a number. Unfortunately, this is using Unicode, so instead of 142
it ends up with 381. Now when I run my UTF8 translation system, of course
the whole thing is using the wrong numbers and it goes kerblooey.
Am I reading the problem right? It's hurting my brain.
If I've diagnosed the problem correctly, then I can see a few potential
solutions:
Can I pass the binary string data directly to Flash without converting it to
text?
Can Flash read the character as ANSI instead of Unicode, getting the same
value as Director?
Otherwise I'm going to have to turn the whole string into an array of
numbers in Director, and pass that array to Flash. And that's going to annoy
me...
What a mess.
Danny
_______________________________________________
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com