I'm using Intellij Ultimate. When I run the html file in browser it works well with encoding. But, when I run as localhost url (tomcat server) the characters cracks.image of encoding cracked this is my if.html file
<!DOCTYPE html>
<html lang="en">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<head>
<meta charset="utf-8">
<title>title</title>
</head>
<h1>If-else Example</h1>
<form method="post" action="if.jsp">
<body>
이름 : <label>
<input name="name">
</label>
<p></p>
좋아하는 색깔 : <label>
<select name="color">
<option value="blue" selected>파랑</option>
<option value="red">빨강</option>
<option value="orange">오렌지</option>
<option value="etc">기타</option>
</select>
</label>
<p></p>
<input type="submit" value="보내기">
</body>
</form>
</html>
I mapped this if.html file through web.xml.
<servlet>
<servlet-name>if</servlet-name>
<jsp-file>/if.html</jsp-file>
<init-param>
<param-name>encoding</param-name>
<param-value>UTF-8</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>if</servlet-name>
<url-pattern>*.html</url-pattern>
</servlet-mapping>
Other Jsp files or mapped java files encode well in UTF-8 but, only html files cracked. I want to encode html file as UTF-8 properly. Thank you for your help in advance.
I tried following this way but doesn't work.
- set Intellij project encoding, global encoding, Default encoding for properties files to UTF-8
- added java option in Tomcat Configuration -Dfile.encoding=UTF-8
- added Intellij custom VM option -Dfile.encoding=UTF-8
- added URLEncoding="UTF-8" in server.xml at tomcat container