15

I am using meld to visualise a diff between two files. meld shows the diff output in... something like Japanese or Chinese?

Any idea what could happen? A locale issue? What is strange is that when using diff or colordiff in terminal, they work perfectly!

Thanks!

Meld shows unreadable output

Matifou
  • 648
  • 1
  • 7
  • 23
  • I've just gotten this as well, with a git meld. Oddly, only *one* of the LOCAL/BASE/REMOTE files is affected. – Ziv Dec 12 '16 at 08:24
  • Not familiar with meld but I'd suggest trying to run it as `LC_ALL=C meld` from command-line and see if issue persists. – Sergiy Kolodyazhnyy Jan 26 '17 at 00:03
  • My case was actually the Windows-1252 encoding and solved like here -> https://stackoverflow.com/questions/38919384/configure-meld-encoding-to-cp-1252 – eri0o May 13 '19 at 15:21

3 Answers3

20

Same problem here: File encoding is not correctly detected.

In my case this is due to meld's "detect-encodings" settings.

Check with:

$ gsettings get org.gnome.meld detect-encodings
['utf8']

Only utf8 is detected.

To workaround this issue add 'latin1' or whatever encoding your file has:

$ gsettings set org.gnome.meld detect-encodings "['utf8','latin1']"
Inaki Saez
  • 301
  • 2
  • 3
2

Short extension to the last answer:

I had to add quotes to the [] part:

gsettings set org.gnome.meld detect-encodings "['utf8','latin1']"

executing it in a terminal in Ubuntu 16.04

Zanna
  • 69,223
  • 56
  • 216
  • 327
DrUweDamm
  • 21
  • 1
1

I am pretty sure this is a encoding issue. Your terminal is probably in UTF-8 and the file is ISO. This is a new problem as early as 16.04, I think it may happen in 15.04 as well but I can confirm that it doesn't in 12.04.

Try checking your terminal where you are running meld by typing "locale". and you should get something like this:

$ locale
LANG=en_US.UTF-8
LANGUAGE=en_US
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=

Then type " file " for each of your files and make sure they match your terminal.

On a side note I have been having a number of encoding issues between UTF-8 and ISO that really should never happen in 16.04.

What worked for me was running iconv on each file:

iconv -f ISO-8859-15 -t UTF-8 file_1.txt >file_1.tmp;
iconv -f ISO-8859-15 -t UTF-8 file_2.txt >file2.tmp;
mv file_1.tmp file_1.txt;
mv file_2.tmp file_2.txt;
meld file_1 file_2
badner
  • 153
  • 9
  • 1
    Thanks for your help! The `file` command is not very informative. (just says ASCII). I tried to used `fromdos` to convert but still get the same output... SHould I try another command? Thanks! – Matifou Jan 25 '17 at 22:39
  • I used iconv on each file to convert from ISO to utf-8 and everything magically worked. Odd because there are no chars which should make a difference between the two. – badner Jan 25 '17 at 22:58
  • I will add the command to my answer – badner Jan 25 '17 at 22:59