icdiff icon indicating copy to clipboard operation
icdiff copied to clipboard

Feature Request: auto-detect encodings

Open man0xff opened this issue 9 years ago • 3 comments

I use icdiff with git. It's awesome! But some of my project files are not in utf8 and I can not view diff with that files. Would it be more reliable not to throw exception but to convert bad symbols as escape sequences or stub chars? $ git diff HEAD~ error: file '/tmp/R97Zaw_http.c' not valid with encoding 'utf-8': <invalid continuation byte> at 74350-74351

man0xff avatar Feb 15 '16 15:02 man0xff

I get the same error when I diff two binary file.

tenfyzhong avatar May 23 '17 01:05 tenfyzhong

The correct way will be to enable encoding auto-detection instead. There are many libraries for that. At the moment use something like --encoding=ISO8859 for example (use file MYFILE.txt to check the encoding).

thinrope avatar Aug 23 '17 08:08 thinrope

I resolved it with uchardet tool, like this:

icdiff --encoding=$(uchardet $file1) $file1 $file2

asvd avatar Jul 18 '20 09:07 asvd