[英]Spring Integration http outbound-gateway and UTF-8
I'm trying to use Spring Integration to load a multilingual XML file from the web. 我正在尝试使用Spring Integration从Web加载多语言XML文件。 Unfortunately, it appears that Spring Integration is treating it as some other form of encoding.
不幸的是,Spring Integration似乎将其视为其他形式的编码。 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. 我检索的文本被视为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. 我真的希望我在XML配置中做错了什么。 Any suggestions?
有什么建议么?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.