While working on a recent project with counterpart @zackattack27, we found the need to encrypt a string into Little Endian for compatibility with an old system this project interacted with. Unfortunately we were having little luck finding support for this encoding, even through the Adobe ActionScript documentation. In an effort of reaching out @zackattack27 contacted @AdobeFlash via twitter and was pointed in the right direction. Here is the resulting code that will help you encode your strings.
public function convertToLittleEndian($string:String):String
{
var utf16:ByteArray = new ByteArray();
utf16.writeBoolean(false);
utf16.endian = Endian.LITTLE_ENDIAN;
utf16.position = 0;
utf16.writeMultiByte($string, "unicode");
return String(utf16);
}
Monday, March 28, 2011
ActionScript Does Support Little Endian
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment