I want to compare two UTF-8 encoded text files. Can the Linux commands diff and comm handle this encoding?
-
Note it is not Linux that does it. The kernel does not get involved with these matters. It is the Gnu tools that do it (If you are running a Linux based Unix system, then it will be Gnu).ctrl-alt-delor– ctrl-alt-delor2017-06-22 17:15:23 +00:00Commented Jun 22, 2017 at 17:15
Add a comment
|
2 Answers
Why not?
2 text files in Russian
$ file -i test1.txt test2.txt
test1.txt: text/plain; charset=utf-8
test2.txt: text/plain; charset=utf-8
$ cat test1.txt
Привет
$ cat test2.txt
Добрый день
$ diff test1.txt test2.txt
1c1
< Привет
---
> Добрый день
Use the -i parameter to force file to print information about the encoding
I created two files containing some caracters
One encoded in utf-8 and one encoded in iso-8859-1
$ file -i *
file1: text/plain; charset=utf-8
file2: text/plain; charset=iso-8859-1
-
I think they were asking about the
diffandcommcommands, notfile2017-02-04 11:54:35 +00:00Commented Feb 4, 2017 at 11:54