Flex string problem, binary 00 after the thing is lost (base64 solve)

Source: Internet
Author: User

Recently in the development of flex, in the use of weborb.net found that if the transfer object in the binary 00 after the thing is lost.

The original flex string was terminated with 00来. This is more depressing, temporarily use Base64 code to solve

Calling code

1import com.dynamicflash.utils.Base64;
2
3//编码和解码字符串
4var source:String = "Hello, world";
5var encoded:String = Base64.encode(source);
6trace(encoded);
7
8var decoded:String = Base64.decode(encoded);
9trace(decoded);
10
11
12//编码和解码 ByteArray
13var obj:Object= {name:"Dynamic Flash",url:"http://dynamicflash.com"};
14var source:ByteArray = new ByteArray();
15source.writeObject(obj);
16
17var encoded:String = Base64.encodeByteArray(source);
18trace(encoded);
19
20
21var decoded:ByteArray = Base64.decodeToByteArray(encoded);
22obj = decoded.readObject();
23trace(obj.name + "(" + obj.url + ")");

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.