I am using jQuery DataTables to display pagination data from a MySQL database.
When I show normal characters in this table, it shows the correct data in the table. But while retaining Unicode characters, does it only display characters ? .
Below are my html codes for this page:
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%> <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>Township</title> <link rel="stylesheet" href="<c:url value="/resources/styles/township.css" />"/> <link rel="stylesheet" type="text/css" href="//cdn.datatables.net/1.10.0/css/jquery.dataTables.css"> <script type="text/javascript" charset = "utf8" src="//code.jquery.com/jquery-1.10.2.min.js"></script> <script type="text/javascript" charset = "utf8" src="//cdn.datatables.net/1.10.0/js/jquery.dataTables.js"></script> <script type="text/javascript" charset = "utf8" > </script> </head> <body> <div id="container"> <div id="table"> <form:form action="" method="GET" align="center"> <br> <table style="border: 3px;background: rgb(243, 244, 248); width: 90%; margin:20px auto;"><tr><td> <table id="example" class="display"> <thead> <tr> <th>Code</th> <th>Township</th> <th>Division</th> <th>Action</th> </tr> </thead> </table> </td></tr></table> <br> </form:form> </div> </div> </body> </html>
My internal Java code for this table is:
@RequestMapping(value = "/springPaginationDataTables.web", method = RequestMethod.GET, produces = "application/json") public @ResponseBody String springPaginationDataTables(HttpServletRequest request) throws IOException { Integer pageNumber = 0; if (null != request.getParameter("iDisplayStart")) pageNumber = (Integer.valueOf(request.getParameter("iDisplayStart"))/10)+1; Integer pageDisplayLength = Integer.valueOf(request.getParameter("iDisplayLength")); List<Township> listTownship = townshipDao.getList(pageNumber, pageDisplayLength); int count = townshipDao.getCount(); JsonObject<Township> townshipJsonObject = new JsonObject<Township>();
I got the following result in a data table that shows ? instead of Unicode characters:

Please help me solve this problem.
java jquery html ajax
Thiha Zaw Apr 25 '15 at 12:18 2015-04-25 12:18
source share