Commit 581fee66 authored by Alex Wenckus's avatar Alex Wenckus Committed by alex

Possible fix for character encoding issues

git-svn-id: http://svn.igniterealtime.org/svn/repos/wildfire/trunk@6270 b35dd754-fafc-0310-a699-88a17e54d16e
parent ad98c8f2
...@@ -128,6 +128,20 @@ public class XMPPPacketReader { ...@@ -128,6 +128,20 @@ public class XMPPPacketReader {
return read(createReader(in)); return read(createReader(in));
} }
/**
* <p>Reads a Document from the given stream</p>
*
* @param charSet the charSet that the input is encoded in
* @param in <code>InputStream</code> to read from.
* @return the newly created Document instance
* @throws DocumentException if an error occurs during parsing.
*/
public Document read(String charSet, InputStream in)
throws DocumentException, IOException, XmlPullParserException
{
return read(createReader(in, charSet));
}
/** /**
* <p>Reads a Document from the given <code>Reader</code></p> * <p>Reads a Document from the given <code>Reader</code></p>
* *
...@@ -437,6 +451,10 @@ public class XMPPPacketReader { ...@@ -437,6 +451,10 @@ public class XMPPPacketReader {
protected Reader createReader(InputStream in) throws IOException { protected Reader createReader(InputStream in) throws IOException {
return new BufferedReader(new InputStreamReader(in)); return new BufferedReader(new InputStreamReader(in));
} }
private Reader createReader(InputStream in, String charSet) throws UnsupportedEncodingException {
return new BufferedReader(new InputStreamReader(in, charSet));
}
} }
/* /*
......
...@@ -238,6 +238,6 @@ public class HttpBindServlet extends HttpServlet { ...@@ -238,6 +238,6 @@ public class HttpBindServlet extends HttpServlet {
XMPPPacketReader reader = new XMPPPacketReader(); XMPPPacketReader reader = new XMPPPacketReader();
reader.setXPPFactory(factory); reader.setXPPFactory(factory);
return reader.read(request.getInputStream()); return reader.read("utf-8", request.getInputStream());
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment