i am trying to get UTF-8 string with using servlet, my code block is showing below;
request.setCharacterEncoding("UTF-8");
response.setContentType("text/html;charset=UTF-8");
but I could not get the utf-8 string , interesting chars is apperaing... Is there any way to get UTF-8 string ?
The problem could be that the string received by the servlet is not really in UTF-8. Make sure that the JSP calling the servlet is also in UTF-8. Try adding this at the top of your JSP:
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.