我正在开发一个Java应用程序,它从互联网调用PHP,它会给我一个XML响应。
在响应中包含这个单词:"Próximo",但是当我解析XML的节点并将响应转换为一个字符串变量时,我收到的单词是这样的:"Próximo“。
我该如何解决这个问题呢?
发布于 2012-07-16 02:10:10
可能您在Java应用程序中使用的编码与PHP脚本中的编码不同。尝试设置流的编码,例如
URL oracle = new URL("http://www.yourpage.com/");
URLConnection yc = oracle.openConnection();
BufferedReader in = new BufferedReader(new InputStreamReader(
yc.getInputStream(),"utf-8"));//<-- here you set encoding
//to the same as in your PHP
String inputLine;
while ((inputLine = in.readLine()) != null)
System.out.println(inputLine);https://stackoverflow.com/questions/11494069
复制相似问题