SCJP 91%, SCWCD 97%
Shashank Ag wrote:You should send your non acii characters or whole such strings as cdata to avoid such problems.
Cheers,
Naren
(OCEEJBD6, SCWCD5, SCDJWS, SCJP1.4 and Oracle SQL 1Z0-051)
Naren Chivukula wrote:Hi David,
Did you trying escaping those characters if they appear fewer?
For example (Note: no spaces between the characters in escape sequences, otherwise they would appear as they are after I post this message)
ù with & # 2 4 9;
à with & # 2 2 4;
é with & # 2 3 3;
ì with & # 2 3 6;
ø with & # 2 4 8;
Shashank Ag wrote:You should send your non acii characters or whole such strings as cdata to avoid such problems.
Seems a little cumbersume...
Cheers,
Naren
(OCEEJBD6, SCWCD5, SCDJWS, SCJP1.4 and Oracle SQL 1Z0-051)
Naren Chivukula wrote:Hi David,
Seems a little cumbersume...
Well, I don't recommend to do it unless as I said you have to do only a fewer characters conversion.
What I can suggest you perhaps a simple approach is to covert your original xml string (with umlauts characters) bytes converted to "UTF-8" encoding(You need to know the original xml string encoding for coversion) using Java String methods. Then, write the bytes to SOAP message. Now, your non-UTF-8 characters are encoded/escaped (like in the example I provided) and safely trasmit. Once you read these bytes at the other end, you have to reverse this process of conversion to get the original String.
The encoding used on the outgoing message is UTF-8, the default (I have tried setting it explicitly but it has not effect).
Cheers,
Naren
(OCEEJBD6, SCWCD5, SCDJWS, SCJP1.4 and Oracle SQL 1Z0-051)
Naren Chivukula wrote:Hi David,
The encoding used on the outgoing message is UTF-8, the default (I have tried setting it explicitly but it has not effect).
Interoperable web services complying with WS-I support only UTF-8 or UTF-16. So, setting explicitly to other encoding might fail to parse correctly during unmarshalling.
What is your original xml string character encoding? Did you try converting your original xml string to "UTF-8" encoding xml string before setting bytes to your SOAP message?
Cheers,
Naren
(OCEEJBD6, SCWCD5, SCDJWS, SCJP1.4 and Oracle SQL 1Z0-051)
Naren Chivukula wrote:I think you haven't quite understood me. Never mind! Try to use this code snippet.
byte[] utf8Bytes=new String(latingString.getBytes(), isoCharset).getBytes(UTF_8);
Cheers,
Naren
(OCEEJBD6, SCWCD5, SCDJWS, SCJP1.4 and Oracle SQL 1Z0-051)
Naren Chivukula wrote:Make sure you are using Java6!
Cheers,
Naren
(OCEEJBD6, SCWCD5, SCDJWS, SCJP1.4 and Oracle SQL 1Z0-051)
Naren Chivukula wrote:Hi David,
I have provided a generic solution (if it works ) and you have to fit that to your requirement. If you are SOAP message details are coming from a HTML posted form, then the encoding has to be changed on the front-end from UTF-8 to ISO-8859-1 to get correct characters to your application before sending the SOAP request. If using JSP, you can do it using <%@ page contentType="text/html; charset=ISO-8859-1" %>. You may have to use trial and error method in order to make it work for you.
Cheers,
Naren
(OCEEJBD6, SCWCD5, SCDJWS, SCJP1.4 and Oracle SQL 1Z0-051)
Naren Chivukula wrote:The above character set encoding is for redering the response content. Can you try this <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> on top of your JSP, which should send form data in ISO-8859-1 encoding?
Cheers,
Naren
(OCEEJBD6, SCWCD5, SCDJWS, SCJP1.4 and Oracle SQL 1Z0-051)
Cheers,
Naren
(OCEEJBD6, SCWCD5, SCDJWS, SCJP1.4 and Oracle SQL 1Z0-051)
Maybe he went home and went to bed. And took this tiny ad with him:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
|