I'm trying to use Spring Integration to load a multilingual XML file from the web. Unfortunately, it appears that Spring Integration is treating it as some other form of encoding. Here's the relevant part of my config:
<int-http:outbound-gateway id="example"
request-channel="requests"
url="http://localhost/test.xml"
http-method="GET"
expected-response-type="java.lang.String"
charset="UTF-8"
reply-timeout="1234"
reply-channel="replies"/>
The text I retrieve is treated like it's ISO-8859-1. The reason I believe this, is because if I recode and then decode, I get the correct text. Something like this:
public void handleReply(String rawXML) {
String forRealzies = "";
try {
String hack1 = URLEncoder.encode(rawXML, "ISO-8859-1");
forRealzies = URLDecoder.decode(hack1, "UTF-8");
} catch(UnsupportedEncodingException e1) {
e1.printStackTrace();
}
// forRealzies now has the properly encoded String
}
I'm really hoping I'm doing something wrong in the XML config. Any suggestions?
You should set the charset
on the content-type
; see here .
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.