How to convert ascii to utf8 with maven

2019-07-24 09:44发布

I have some generated classes, which are generated with ASCII encoding. But to compile this classes, the classes must be in UTF-8 encoding.

So I need a plugin that converts this classes from ASCII or ISO-8859-1 respectivly to 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.

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.

Thanks

2条回答
够拽才男人
2楼-- · 2019-07-24 10:25

ASCII is a subset of UTF-8. All symbols that can be expressed in ASCII are encoded in the same way in UTF-8.

(I have a feeling that your problem has got to be too trivial to be true. Please edit your question if the case is actually more complex.)

查看更多
虎瘦雄心在
3楼-- · 2019-07-24 10:26

If all else fails, the AntRun Plugin and Ant's Copy Task with its encoding and outputencoding attributes should do the job.

查看更多
登录 后发表回答