如何使用Maven将ASCII转换为utf8 [英] How to convert ascii to utf8 with maven
问题描述
我有一些生成的类,这些类是用ASCII编码生成的.但是要编译这些类,这些类必须采用UTF-8编码.
I have some generated classes, which are generated with ASCII encoding. But to compile this classes, the classes must be in UTF-8 encoding.
因此,我需要一个插件来将此类从ASCII或ISO-8859-1分别转换为UTF-8.
So I need a plugin that converts this classes from ASCII or ISO-8859-1 respectivly to UTF-8.
我试图使用maven-resources-plugin和native2ascii-maven-plugin来转换文件.但是他们不是我所需要的. maven-resources-plugin只能配置一个标志,该标志用于读取输入和写入输出.我一直使用UTF-8.因此,显然没有任何作用.
I tried to use the maven-resources-plugin and the native2ascii-maven-plugin to convert the files. But they didn't what I need. The maven-resources-plugin can only by configured with one flag, that is used for reading input and writing output. I always use UTF-8. So it's obviously that it hasn't any effect.
另一方面,native2ascii-maven-plugin只能以错误的方向转换,即从UTF-8转换为ASCII.但是我需要将文件从ASCII转换为UTF8.
On the other hand the native2ascii-maven-plugin only converts in the wrong direction, namly from UTF-8 to ASCII. But I need to convert the files from ASCII to UTF8.
是否还有其他插件或哪个插件可以解决我的问题?我必须使用哪种配置?请提供绝对有效的配置代码段.
Are there any other plugins or which plugin solves my problem? Which configuration I have to use? Please provide a definitely working configuration snippet.
谢谢
推荐答案
如果其他所有方法均失败,则复制任务及其outputencoding
属性应该可以完成工作.
If all else fails, the AntRun Plugin and Ant's Copy Task with its encoding
and outputencoding
attributes should do the job.
这篇关于如何使用Maven将ASCII转换为utf8的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!