1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Jsersyで文字化け

Posted at

開発環境がWindowsでJerseyからJSPを表示させるとき、文字化ける。

前提条件

  • Java, JSPのファイルエンコードはEclipseでUTF-8に指定
  • JSPのメタタグは以下の用に指定
  • eclipse.iniでファイルエンコードを指定し、コンパイル時に引き渡している

<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!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">
</head>
<body>

</body>
</html>

eclipse.ini

-Dfile.encoding=utf-8

原因

  • Tomcatの実行時オプションを指定していなかったので、環境固有(MS932)になっていた

解決

  • Tomcatの実行時オプションを指定(CATALINA_OPTS)

set CATALINA_OPTS=-Dfile.encoding=utf-8

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?