java - save unicode codepoint instead of html entities in mysql using jsp -
i have made necessary changes database variable 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 included tag on jsp:
<meta http-equiv="content-type" content="text/html; charset=utf-8">
but when non english text entered converted , store in form of html entities i.e #&number format
i want enter in unicode
codepoint format \u6709
without 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>
the browser translated special unicode code points in input html entities because of form missing accept-charset of utf-8. browser thinks posted form results cannot in utf-8 server.
<form id="storemsgform" method="post" action="createnewmessage" accept-charset="utf-8">
Comments
Post a Comment