lundi 13 juin 2016

save unicode codepoint instead of html entities in mysql using jsp

I have made all the necessary changes for database variable to UTF8

  • character_set_client utf8
  • character_set_connection utf8
  • character_set_database utf8
  • character_set_filesystem binary
  • character_set_results utf8
  • character_set_server utf8
  • character_set_system utf8

Also added the included the tag on jsp:

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> 

But when a non English text is entered it get converted and store in form of html entities i.e #&number format

I want to enter it in Unicode codepoint format like u6709 without any java code converter program:

<%@ taglib uri="http://www.springframework.org/tags/form" prefix="form" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
  <form id="storeMsgForm"  method="post" action="createnewmessage" >
  <input type="text" name="msg_code">
   <input type="text" name="message">
   <input type="submit" id="saveEmployee" class="btn btn-primary" value="Save">
  </form>

  <c:forEach var="listvalue" items="${allMsg.allmessage}">
  ${listvalue.msg_code} 
  ${listvalue.message}
  <br/>
  </c:forEach>

<% 
 if (request.getCharacterEncoding() == null) {
        request.setCharacterEncoding("UTF-8");

    }
  %> 
</body>
</html>

Aucun commentaire:

Enregistrer un commentaire