Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

how to set encoding type for e4x result

Avatar

Level 1
I have a application with front end Flex and Server side App
in Java. I am using HttpService to communicate to Java application
(Web). I am sending data in xml format to flex and parsing it as
e4x format. From service side I am setting the charset as
windows-1252 and xml encoding is also windows-1252. In Flex I am
getting some junk characters. But When I post the same http request
from browser, I am able to view the characters with expected
encoding.

Can anybody clue me on getting xml data in required encoding
type (charset) in Flex.



Thanks in Advance,

Gokul Ram.T
1 Reply

The message is old, but the problem is opened and I believe that many people have troubles with getting appropriate encoding in e4x result.

I have excactly same problem like Gokul, only difference is that I am trying to get ISO-8859-2 charset. HttpService deffinition looks like this:

var source:HTTPService = new HTTPService();

source.method = "POST";

source.resultFormat = "e4x";

source.contentType = "text/xml; charset=ISO-8859-2";

source.headers = {"Content-Type": "text/xml; charset=ISO-8859-2"};

So I suppose that everything what can be set is set. But still in result XMLthere are no national chars. I also get correct XML when I request it in browser, but requesting by Flex and HttpService makes problem.

Does anyone have same problem and find out something to handle this?

Avatar

Level 1

AFAIK, "text/xml; charset=ISO-8859-2"; is not supported (I might be wrong though).

The docs only mention these two:

- application/x-www-form-urlencoded (the default)

- application/xml

http://livedocs.adobe.com/flex/3/langref/mx/rpc/http/HTTPService.html#contentType

Sure, my bad, but this is not an issue, in fact it doesnt metter what I put there i will always get utf-8 encoding