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 { ...@@ -320,7 +320,7 @@ public class DirectControlServlet extends HttpServlet {
320 320
321 if ("application/json".equals(contentType)) { 321 if ("application/json".equals(contentType)) {
322 // Read request body as JSON and insert into the context 322 // Read request body as JSON and insert into the context
323 Map<String, Object> items = UtilGenerics.cast(JSON.from(UtilIO.readString(new FileReader(tmpFile))).toObject(Map.class)); 323 Map<String, Object> items = UtilGenerics.cast(JSON.from(UtilIO.readString(new InputStreamReader(new FileInputStream(tmpFile), "UTF-8"))).toObject(Map.class));
324 for (Object key : items.keySet()) { 324 for (Object key : items.keySet()) {
325 context.put((String) key, items.get(key)); 325 context.put((String) key, items.get(key));
326 } 326 }
...@@ -464,12 +464,12 @@ public class DirectControlServlet extends HttpServlet { ...@@ -464,12 +464,12 @@ public class DirectControlServlet extends HttpServlet {
464 setResponseNoCache(); 464 setResponseNoCache();
465 465
466 if ("JSON".equals(outputHandler)) { 466 if ("JSON".equals(outputHandler)) {
467 response.setContentType("application/x-json"); 467 response.setContentType("application/x-json;charset=UTF-8");
468 468
469 PrintWriter writer = response.getWriter(); 469 PrintWriter writer = response.getWriter();
470 470
471 String jsonStr = JSON.from(result).toString(); 471 String jsonStr = JSON.from(result).toString();
472 response.setContentLength(jsonStr.getBytes("UTF8").length); 472 response.setContentLength(jsonStr.getBytes("UTF-8").length);
473 writer.write(jsonStr); 473 writer.write(jsonStr);
474 writer.flush(); 474 writer.flush();
475 writer.close(); 475 writer.close();
......