Failing to save modified files from MELD.
Thank you for the great package. I am using MELD on Debian GNU/Linux distribution. It worked just fine until earlier this year.
However, today, when I tried to a comparison of a pair of directories and made changes to make them identical, and tried to save the modified files when I tried to close the tab and prompted to save files, MELD failed to save files [without any visible indication of the failures.]
The tab did not close and when I tried to close it again, I got the prompt to save the files again.
So one issue is that MELD fails to report the failure of saving file(s) in a visible manner using its GUI.
Funny, I thought. I experimented a little, and eventually I figured that the terminal window where I originally invoked meld had these warning/error lines.
!meld
meld ~/repos/dot-files/ ~/
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/meld/meldwindow.py", line 542, in <lambda>
icon, "", lambda b: page.on_delete_event())
File "/usr/lib/python3/dist-packages/meld/filediff.py", line 841, in on_delete_event
response = self.check_save_modified()
File "/usr/lib/python3/dist-packages/meld/filediff.py", line 807, in check_save_modified
self.save_file(i)
File "/usr/lib/python3/dist-packages/meld/filediff.py", line 1495, in save_file
text = text.encode(encoding)
LookupError: unknown encoding: EUC-JP-MS
repetition of the above since I tried a few saving operations.
Obviously MELD seems to have failed to write the files. My take is that somehow python3 run-time figures that the encoding of the files are EUC-JP-MS and a function LookupError complained that it does not know anything about such encoding, EUC-JP-MS.
It could be either python issue or GNU/Linux distribution issue.
My take on this: EUC-JP-MS seems suspicious (and looks too much Windows-specific?). There IS an encoding called EUC-JP (alias) under Linux for a looong time and some files I inherited over the years have this encoding.
grep -i euc /etc/locale.gen
ja_JP.EUC-JP EUC-JP
# ko_KR.EUC-KR EUC-KR
# zh_TW.EUC-TW EUC-TW
I suspect that the python3's text encoding detector misinterprest the particular file, ~/.emacs in this case, as having this strange encoding EUC-JP-MS while it has the simple EUC-JP encoding. (My .emacs file is close to 28 yars old. It has a few lines that mention a modification in 1991. Back then UNICODE is a future target and EUC-JP encoding was very popular in Japan.) That it is encoded EUC-JP is clear since the next command executes successfully. (Also I checked the file very carefully that it does not contain any suspicious characters that falls outside EUC-JP. See the note at the end.)
iconv -f euc-jp -t utf8 .emacs
What hould I do?
Not being able to use MELD for merging work hampers my workflow very much.
Thank you again for this great package.
PS: I found a web page that mentions EUC-JP-MS (the web page is in Japanese). It mentions that EUC-JP-MS is an encoding devised by an industrial consorcium to handle EUC-JP character set under Windows and throwing some additional stuff. In the diagram of the following URL, there are four different encodings. The diagram shows how each diagram covers the character sets. The characters covered by the most popular EUC-JP (Non-Japanese characters such as characters covered by US ASCII and the Japanese characters covered by JIS X 0208) is the light blue area the minimalist set shared among the four encodings.
The right-most colum is EUC-JP-MS (or actually called euc_JP-MS). It adds some character set to the characters covered by EUC-JP in a certain manner. Microsoft itself has devised CP51932 (the second leftmost column), and if someone mentions casually the encoding that supports EUC-JP under Windows, it is quite likely this CP51932 is intended implicitly. However, DO NOTE THAT IT does not handle the additional characters (outside the character set covered by EUC-JP) differently from other encodings such as EUC-JP-MS.
https://msyk.at.webry.info/200511/article_2.html
Well, after reading the above URL and considering the failure of MELD, I am afraid that python3's encode detection routine was written by someone who only understands Windows encodings and not realize that EUC-JP has been used widely under UNIX for a long time (preceding the usage by linux by almost 20 years) in the Japanese UNIX user community.