显示葡萄牙语字符的Andr​​oid葡萄牙语、字符、oid、Andr

2023-09-04 23:07:04 作者:你的脸皮比作业还厚

我开发一个Android应用程序,当它被suposed写出像NAO或cabeça,字与字〜或C为例,它写道:à£或§ 。我已经选中的源文件编码,它是UTF-8。

I'm developing an Android app and when it was suposed to write words like "não" or "cabeça", with characters with "~" or "ç" for example, it writes "ã" or "ç". I already checked source files encoding and it is UTF-8.

推荐答案

看起来PTED为ISO-8859-X UTF8跨$ P $。

Looks like UTF8 interpreted as ISO-8859-x.

在理论上,你可以提供的javac编译 -encoding 在命令行中的UTF-8,但是这将是错误的解决方案。

In theory, you could supply the javac compiler -encoding UTF-8 on the command line but that would be the wrong solution.

相反,将所有用户面对的字符串到一个XML资源文件。在有单向code字符编码工作开箱。

Instead, move all your user-facing strings to an XML resource file. In there unicode character encoding works out of the box.

延伸阅读: http://developer.android.com/guide /topics/resources/string-resource.html