Best way to convert text files between character sets?

后端 未结 21 2301
再見小時候
再見小時候 2020-11-22 04:42

What is the fastest, easiest tool or method to convert text files between character sets?

Specifically, I need to convert from UTF-8 to ISO-8859-15 and vice versa.

21条回答
  •  一整个雨季
    2020-11-22 05:06

    to write properties file (Java) normally I use this in linux (mint and ubuntu distributions):

    $ native2ascii filename.properties
    

    For example:

    $ cat test.properties 
    first=Execução número um
    second=Execução número dois
    
    $ native2ascii test.properties 
    first=Execu\u00e7\u00e3o n\u00famero um
    second=Execu\u00e7\u00e3o n\u00famero dois
    

    PS: I writed Execution number one/two in portugues to force special characters.

    In my case, in first execution I received this message:

    $ native2ascii teste.txt 
    The program 'native2ascii' can be found in the following packages:
     * gcj-5-jdk
     * openjdk-8-jdk-headless
     * gcj-4.8-jdk
     * gcj-4.9-jdk
    Try: sudo apt install 
    

    When I installed the first option (gcj-5-jdk) the problem was finished.

    I hope this help someone.

提交回复
热议问题