33225dc9 by Ean Schuessler

Merge branch 'BF-7877' of /home/git/repositories/brainfood/ofbiz-directcontrolservlet

2 parents 1696b6ea 6bf4b8e8
......@@ -320,7 +320,7 @@ public class DirectControlServlet extends HttpServlet {
if ("application/json".equals(contentType)) {
// Read request body as JSON and insert into the context
Map<String, Object> items = UtilGenerics.cast(JSON.from(UtilIO.readString(new FileReader(tmpFile))).toObject(Map.class));
Map<String, Object> items = UtilGenerics.cast(JSON.from(UtilIO.readString(new InputStreamReader(new FileInputStream(tmpFile), "UTF-8"))).toObject(Map.class));
for (Object key : items.keySet()) {
context.put((String) key, items.get(key));
}
......@@ -464,12 +464,12 @@ public class DirectControlServlet extends HttpServlet {
setResponseNoCache();
if ("JSON".equals(outputHandler)) {
response.setContentType("application/x-json");
response.setContentType("application/x-json;charset=UTF-8");
PrintWriter writer = response.getWriter();
String jsonStr = JSON.from(result).toString();
response.setContentLength(jsonStr.getBytes("UTF8").length);
response.setContentLength(jsonStr.getBytes("UTF-8").length);
writer.write(jsonStr);
writer.flush();
writer.close();
......