Javadoc 错误:用于编码 ASCII 的不可映射字符

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/22599003/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-13 16:45:22  来源:igfitidea点击:

Javadoc error: unmappable character for encoding ASCII

javaeclipseencodingutf-8javadoc

提问by Spoofy

Im trying to create a Javadoc but i can't.

我试图创建一个 Javadoc,但我不能。

I have written my comments in swedish s? they content charachters as ?,?,?. This is giving me over 248 erros.

我用瑞典语写了我的评论?他们的内容字符为?,?,?。这给了我超过 248 个错误。

Is there a way to change the encoding for the whole Project?

有没有办法改变整个项目的编码?

I have tried:

我试过了:

  1. Right-clicked on the project
  2. Choosed Resource
  3. Change to UTF-8
  4. Restarted Eclipse
  5. Create new Javadoc
  1. 右键单击项目
  2. 选择的资源
  3. 更改为 UTF-8
  4. 重启 Eclipse
  5. 创建新的 Javadoc

This results in the following error:

这会导致以下错误:

error: unmappable character for encoding ASCII

错误:用于编码 ASCII 的不可映射字符

Is there something else i can do to solve this problem?

我还能做些什么来解决这个问题?

采纳答案by xav

Specifying UTF-8 as your resource encoding is a good thing to do, but you may also perform the following:

指定 UTF-8 作为您的资源编码是一件好事,但您也可以执行以下操作:

If you generate your Javadoc using javadocbinary, you may check its -encodingparameter:

如果您使用javadoc二进制文件生成 Javadoc ,您可以检查其-encoding参数:

javadoc: 
usage: javadoc [options] [packagenames] [sourcefiles] [@files]
...
-encoding <name>          Source file encoding name

Using Eclipse, you may specify this option in field "Extra Javadoc options (...):" in last Wizard step (example: -encoding UTF-8).

使用 Eclipse,您可以Extra Javadoc options (...):在向导的最后一步中的字段“ ”中指定此选项(例如:)-encoding UTF-8

回答by Anad

I know it's old question, but maybe it would be helpful for someone. I want to add something to Xav's answer(I cannot add comments so I write answer):

我知道这是个老问题,但也许对某人有帮助。我想在Xav 的答案中添加一些内容(我无法添加评论,所以我写了答案):

Javadoc gives you following description (javadoc -help):

Javadoc 为您提供以下描述 (javadoc -help):

-encoding <name>    Source file encoding name
-charset <charset>  Charset for cross-platform viewing of generated documentation

"-encoding" parameter indicates how to read characters. You can also use "-charset" option to making your HTML documentation more readable.

“-encoding”参数指示如何读取字符。您还可以使用“-charset”选项使您的 HTML 文档更具可读性。