在Windows蚂蚁编码的问题 - UTF-8的文件,但在吐垃圾变音符号 [英] Ant encoding problem on Windows - UTF-8 files but spits garbage on diacritics

查看:134
本文介绍了在Windows蚂蚁编码的问题 - UTF-8的文件,但在吐垃圾变音符号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

不知怎的,我不能让我的UTF-8来源,发挥好使用Ant。

Somehow I can't get my UTF-8 sources to play nice with Ant.

我收到了一大堆警告:不可映射字符编码ASCII的。我要疯了,真的。几个小时和小时。顺便说一句,我发现5人已使用的标签疯狂。 : - )

I get a whole lot of "warning: unmappable character for encoding ascii". I'm going crazy, really. Hours and hours and hours. Btw, I noticed 5 people already used the tag crazy. :-)

是的,我读过<一个href=\"http://stackoverflow.com/questions/3037100/how-to-specify-character-encoding-for-ant-task-parameters-in-java\">this, <一href=\"http://stackoverflow.com/questions/2219176/how-do-i-modify-the-encoding-argument-to-javac-in-the-android-ant-build-system\">this和别的。谷歌还(至少3或4个不同的搜索的前5页的结果,至少)。有javac的选项。我试过了。也有一些preSET或东西(对不起,3点)。没有任何工作。

And yes, I've read this, this and others. Google also (the first 5 page results of at least 3 or 4 different searches, at least). There are javac options. I've tried. There is also some preset or something (sorry, 3 AM). Didn't work either.

我生成的Andr​​oid APK文件使用Ant。我不能使用Eclipse,所以没有。顺便说一句,蚂蚁文档胡言乱语给我。这些例子都没有用的。我已经失去了我怎样试图计数。

I'm generating Android apk files with Ant. I can't use Eclipse, so no. And by the way, the ant documentation is gibberish to me. Those examples are of no use at all. I've lost count on how much I've tried.

我已经使用指定-Dfile.encoding选项尝试,试图混合与CHCP 65001 Windows命令。做了所有的组合,它甚至使蚂蚁(javac的我猜的)停止随地吐痰的错误,但它仍然没有关系。我的code仍与垃圾carachters结束(一堆??而不是A,I等)。

I've tried using the Dfile.encoding option, tried mixing that with CHCP 65001 Windows command. Did all the combinations, and it even makes Ant (Javac I guess) stop spitting errors, but it still doesn't matter. My code still ends up with garbage carachters (a bunch of ?? instead of á, í etc).

推荐答案

要你谁在Windows上使用UTF-8的源文件,并试图建立自己的Andr​​oid包使用的Proguard的著名的博客文章由丹·盖尔/蒂姆·布雷

To all you who use UTF-8 source files on Windows and was trying to build Android packages with Proguard using the famous blog post by Dan Galpin/Tim Bray.

此编码问题javac的发生(的小费感谢,JesperE )。然而,我无法创建我的项目的文件创建一个新的javac规则,因为需要的参数,我不知道什么的。因此,这里是一个简单的答案(可能不是唯一的答案):

This encoding problem happens with javac (thanks for the tip, JesperE). However, I was unable to create a new javac rule on my project's files, because of needed parameters that I didn't know anything about. So here is the easy answer (probably not the only answer):


  1. 尝试惯用的蚁发布命令。

  2. 请注意,在一开始,有一个输出谈论一些进口ANT规则。对上一开始你会看到一些[设置]规则。你看这一个:

  1. Try the usual "ant release" command.
  2. Notice that, on the start, there is an output talking about some imported ANT rules. Right on the start you will see some [setup] rules. Look for this one:

[设置]导入规则文件:工具\\蚂蚁\\ ant_rules_r3.xml

[setup] Importing rules file: tools\ant\ant_rules_r3.xml

查找文件并打开它。搜索javac的编码。你会看到,设置为ASCII。更改为UTF-8。

Find that file and open it. Search for "javac encoding". You will see that is set to "ascii". Change to "UTF-8".

这就是我在这里做。我敢肯定有一种方法来覆盖这对每个项目的基础。但它一直给我的错误强制性参数,如我说。因此,至少对我来说它是很容易做这样。此外,我只能用UTF-8反正工作。

That's how I did here. I'm sure there is a way to override this on a per-project basis. But it kept giving me errors on mandatory parameters, as I said. So for me at least it was that much easier doing this way. Besides, I only work with UTF-8 anyway.

祝商祺!

这篇关于在Windows蚂蚁编码的问题 - UTF-8的文件,但在吐垃圾变音符号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆