Skip to content

Commit

Permalink
Merge pull request #20 from divyeshtopiya/master
Browse files Browse the repository at this point in the history
fix: special char is not being saved or shown, set charset=UTF-8 in a…
  • Loading branch information
Arjun Surendra authored Jul 29, 2016
2 parents 656c223 + 4e0b8e7 commit b5f0966
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/main/java/com/deem/zkui/controller/Export.java
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ protected void doGet(HttpServletRequest request, HttpServletResponse response) t
for (LeafBean leaf : leaves) {
output.append(leaf.getPath()).append('=').append(leaf.getName()).append('=').append(ServletUtil.INSTANCE.externalizeNodeValue(leaf.getValue())).append('\n');
}// for all leaves
response.setContentType("text/plain");
response.setContentType("text/plain;charset=UTF-8");
try (PrintWriter out = response.getWriter()) {
out.write(output.toString());
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/deem/zkui/controller/RestAccess.java
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ protected void doGet(HttpServletRequest request, HttpServletResponse response) t

}

response.setContentType("text/plain");
response.setContentType("text/plain;charset=UTF-8");
try (PrintWriter out = response.getWriter()) {
out.write(resultOut.toString());
}
Expand Down
5 changes: 3 additions & 2 deletions src/main/java/com/deem/zkui/utils/ServletUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ public void renderHtml(HttpServletRequest request, HttpServletResponse response,
templateParam.put("authName", session.getAttribute("authName"));
templateParam.put("authRole", session.getAttribute("authRole"));

response.setContentType("text/html");
response.setContentType("text/html;charset=UTF-8");

Template template = null;
long startTime = System.currentTimeMillis();
Configuration config = new Configuration();
Expand All @@ -74,7 +75,7 @@ public void renderError(HttpServletRequest request, HttpServletResponse response
try {
logger.error("Error :" + error);
Map<String, Object> templateParam = new HashMap<>();
response.setContentType("text/html");
response.setContentType("text/html;charset=UTF-8");
Template template = null;
Configuration config = new Configuration();
config.setClassForTemplateLoading(request.getServletContext().getClass(), "/");
Expand Down

0 comments on commit b5f0966

Please sign in to comment.