字符集,Eclipse 中 JSP 文件的编码仍然是 ISO-8859-1?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/10460185/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Charset, encoding of JSP file in eclipse still ISO-8859-1?
提问by Joe
I manually changed the default encoding of a JSP file to UTF-8, but when I create a new file with template ${encoding}, the charset
is always set to ISO-8859-1
.
我手动将 JSP 文件的默认编码更改为 UTF-8,但是当我使用模板 ${encoding} 创建新文件时,charset
它始终设置为ISO-8859-1
.
How do I change eclipse's setting so that UTF-8 is the default charset for JSP files?
如何更改 eclipse 的设置,以便 UTF-8 是 JSP 文件的默认字符集?
回答by Martin
I had the same problem but changed the settings here:
我遇到了同样的问题,但在这里更改了设置:
Preferences -> General -> Content Types ->
Text -> JSP -> Default Encoding -> UTF-8
It worked for me. Hope it helps.
它对我有用。希望能帮助到你。
回答by Joe
I think you are asking how do you set the template so that ${encoding} will print out UTF-8
, rather than ISO-8859-1
.
我想您是在问如何设置模板,以便 ${encoding} 将打印出UTF-8
,而不是ISO-8859-1
.
If that's the case, you need to follow:
如果是这种情况,您需要遵循:
Window-->Preferences-->Web-->JSP Files
and then just use the drop down box to change to ISO 10646/Unicode(UTF-8)
然后只需使用下拉框更改为 ISO 10646/Unicode(UTF-8)
You will also need to do the same thing for HTML files.
您还需要对 HTML 文件执行相同的操作。
回答by childno?.de
perhaps the same "problem" as like in Eclipse JSP: incorrect default text file encoding
也许与Eclipse JSP 中的“问题”相同:不正确的默认文本文件编码
Add
添加
<%@ page pageEncoding="UTF-8" %>
to your JSP ANDcheck the workspace encoding settings as described by Joe
到您的 JSP并按照 Joe 的描述检查工作区编码设置
回答by Vahap Gencdal
In Eclipse, go to Windows -> Preferences -> Web -> JSP Files
在 Eclipse 中,转到 Windows -> 首选项 -> Web -> JSP 文件
Select UTF-8 encoding from the *Encoding *dropdown box there.
从那里的 *Encoding *下拉框中选择 UTF-8 编码。
回答by Kush Sharma
I think that the encoding parameter has not been set to UTF-8 it needs to be changed from the source where it is coming.
我认为编码参数尚未设置为 UTF-8,它需要从它来的源中进行更改。