6

I am having no problem converting a string to a byteArray of UTF-16 encoded characters, but the application I am trying to communicate with (written in Erlang) only understands Latin-1 encoding. Is there any way of producing a byteArray full of Latin-1 character codes from a string within Actionscript 3?

mat
  • 12,943
  • 5
  • 39
  • 44
Mike Keen
  • 171
  • 1
  • 4
  • 12

1 Answers1

14

byteArray.writeMultiByte(string, "iso-8859-1");

http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/utils/ByteArray.html#writeMultiByte()

Sean
  • 2,632
  • 2
  • 27
  • 35
  • 1
    Yeah, I thought that would do the trick as well, but it actually manages to write the characters themselves instead of the character values. I may be overlooking something obvious. – Mike Keen Dec 12 '08 at 03:09
  • 1
    Can you explain what the difference between the "characters themselves" and "character values" is? – aaaidan Dec 17 '08 at 04:06
  • 1
    Characters are stored in memory as their encoding representation (usually ASCII or UTF-8). For example, the letter "N" is represented as hexadecimal value "4e" in memory. – Mike Keen Dec 22 '08 at 00:43