Those characters that were correctly printed were reported by tcpmon before axis2 touches those bytes.
After that, axis2 reads those bytes as UTF-8 when it should read as ISO-8859-1, and when I extract the strings from OMText.getText() to print for the end user they are all with wrong characters.
Do you got me now?
Thank you,
bruno
Bruno,
ISO-8859-1 is a superset of ASCII, and does include the characters you pointed out, so the encoding is correct.
http://www.htmlhelp.com/reference/charset/
From: Bruno Negrao [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, October 31, 2006 8:41 PM
To: axis-user@ws.apache.org; [EMAIL PROTECTED]
Subject: Re: Converting from UTF-8 to ISO-8859-I with Axis2 and Java
Guys, I found an interesting point. Since my SOAP server is using iso-8859-1, and the xml it sends do set the encoding to iso-8859-1, the
(OMElement) response.getXMLStreamReader().getCharacterEncodingScheme() method should print the string "ISO-8859-1", but it is printin "utf-8".
I think this proves the axis2 libraries will interpret the bytes read from the network as UTF-8 instead of ISO-8859-1, doesn't it?
Bellow is an example of the SOAP response my SOAP server is sending to me (I used tcpmon to get this text)
HTTP/1.0 200 OK
Content-length: 1269
<?xml version="1.0" encoding="iso-8859-1"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<AgendaPesquisa>
<status>0</status>
<ListaContatosPesquisa>
<tipo>C</tipo>
<dono>lucia</dono>
<posicao>177</posicao>
<nome>Abricó Gimarães</nome> <==NOTE: NON-ASCII CHARACTERS ARE CORRECT
<email></email>
</ListaContatosPesquisa>
</AgendaPesquisa>
</soap:Body>
</soap:Envelope>
Bellow is the code snippet from the method where I call ServiceClient.sendReceive() to get the response OMElement.
private OMElement doSoap(String methodName, OMElement method) throws AxisFault {
final EndpointReference targetEPR = new EndpointReference(planetfoneURL + "/pfappspabxutils");
ServiceClient client = new ServiceClient();
Options options = new Options();
options.setTo(targetEPR);
options.setAction(planetfoneURL + "/" + methodName + "#" + methodName);
options.setProperty(org.apache.axis2.context.MessageContextConstants.CHUNKED,org.apache.axis2.Constants.VALUE_FALSE );
options.setProperty("CHARACTER_SET_ENCODING", "ISO-8859-1");
client.setOptions(options);
OMElement response;
response = client.sendReceive(method);
//DEBUG
System.out.println(response.getXMLStreamReader().getCharacterEncodingScheme());
//END DEBUG
return response;
}
Is axis2 ignoring that my server is sending iso-8859-1 data?
thank you,
bruno.