Best way to convert text files between character sets?

后端 未结 21 2035
再見小時候
再見小時候 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:13

    With ruby:

    ruby -e "File.write('output.txt', File.read('input.txt').encode('UTF-8', 'binary', invalid: :replace, undef: :replace, replace: ''))"
    

    Source: https://robots.thoughtbot.com/fight-back-utf-8-invalid-byte-sequences

提交回复
热议问题