FileMerge cannot open my files

Martin's Avatar

Martin

13 Apr, 2011 09:14 AM

I am a newbie to MacHg and now testing out how things work. However, if I diff files I get two empty sides with FileMerge. A look in the log file shows that it seems to be an encoding problem:

13.04.11 11:04:50 FileMerge[72700] The file “testfile.txt” couldn’t be opened using text encoding Unicode (UTF-8).

I checked the encoding of my testfile and "file -I testfile.txt" shows:
testfile.txt: text/plain; charset=unknown-8bit

Another file also shows an empty FileMerge, which is "text/plain; charset=iso-8859-1".
The file ".hgignore" however works in FileMerge (encoding "text/plain; charset=us-ascii").

Any hint what is going wrong there?
Best regards,
Martin

  1. 1 Posted by Martin on 13 Apr, 2011 09:22 AM

    Martin's Avatar

    Here the whole block of log entries after trying to diff one of these files:

    13.04.11 11:04:49 [0x0-0xb70b7].com.jasonfharris.MachHg[72117] Starting FileMerge...
    13.04.11 11:04:50 FileMerge[72700] The file “testfile.txt” couldn’t be opened using text encoding Unicode (UTF-8).
    13.04.11 11:04:50 [0x0-0xb70b7].com.jasonfharris.MachHg[72117] 2011-04-13 11:04:50.644 FileMerge[72700:903] The file “testfile.txt” couldn’t be opened using text encoding Unicode (UTF-8).
    13.04.11 11:04:50 FileMerge[72700] Incorrect NSStringEncoding value 0x0000 detected. Assuming NSStringEncodingASCII. Will stop this compatiblity mapping behavior in the near future.
    13.04.11 11:04:50 [0x0-0xb70b7].com.jasonfharris.MachHg[72117] 2011-04-13 11:04:50.645 FileMerge[72700:903] Incorrect NSStringEncoding value 0x0000 detected. Assuming NSStringEncodingASCII. Will stop this compatiblity mapping behavior in the near future.
    13.04.11 11:04:50 FileMerge[72700] The file “testfile.txt” couldn’t be opened using text encoding Unicode (UTF-8).
    13.04.11 11:04:50 [0x0-0xb70b7].com.jasonfharris.MachHg[72117] 2011-04-13 11:04:50.646 FileMerge[72700:903] The file “testfile.txt” couldn’t be opened using text encoding Unicode (UTF-8).
    13.04.11 11:04:50 FileMerge[72700] Incorrect NSStringEncoding value 0x0000 detected. Assuming NSStringEncodingASCII. Will stop this compatiblity mapping behavior in the near future.
    13.04.11 11:04:50 [0x0-0xb70b7].com.jasonfharris.MachHg[72117] 2011-04-13 11:04:50.646 FileMerge[72700:903] Incorrect NSStringEncoding value 0x0000 detected. Assuming NSStringEncodingASCII. Will stop this compatiblity mapping behavior in the near future.
    13.04.11 11:04:50 FileMerge[72700] The file “testfile.txt” couldn’t be opened using text encoding Unicode (UTF-8).
    13.04.11 11:04:50 [0x0-0xb70b7].com.jasonfharris.MachHg[72117] 2011-04-13 11:04:50.788 FileMerge[72700:903] The file “testfile.txt” couldn’t be opened using text encoding Unicode (UTF-8).
    13.04.11 11:04:50 FileMerge[72700] The file “testfile.txt” couldn’t be opened using text encoding Unicode (UTF-8).
    13.04.11 11:04:50 [0x0-0xb70b7].com.jasonfharris.MachHg[72117] 2011-04-13 11:04:50.798 FileMerge[72700:903] The file “testfile.txt” couldn’t be opened using text encoding Unicode (UTF-8).
    13.04.11 11:04:50 FileMerge[72700] The file “testfile.txt” couldn’t be opened using text encoding Unicode (UTF-8).
    13.04.11 11:04:50 [0x0-0xb70b7].com.jasonfharris.MachHg[72117] 2011-04-13 11:04:50.799 FileMerge[72700:903] The file “testfile.txt” couldn’t be opened using text encoding Unicode (UTF-8).

  2. Support Staff 2 Posted by jason on 13 Apr, 2011 01:43 PM

    jason's Avatar

    Could you send me the repo zipped up into a .zip? (So I can test this.) my email jason at jasonfharris.com.

    In the mean time why don't you try another differ like, DiffMerge, or P4Merge which are both free and reasonably good. Or maybe kaleidoscope. I'll try and find time soon to look at this...

    Thanks,
    Jason

  3. 3 Posted by Martin on 13 Apr, 2011 02:19 PM

    Martin's Avatar

    Thanks, I just sent you a mail.

  4. Support Staff 4 Posted by jason on 14 Apr, 2011 12:31 PM

    jason's Avatar

    I looked at the files in the repo. Thanks! My question is what editor are you using to produce these files? The problem is external to MacHg. FileMerge is showing its age a bit and to get it to do diffs correctly MacHg changes the encoding of files to UTF-8 before diffing them. It does this by issuing the command:
    xattr -w com.apple.TextEncoding "UTF-8;134217984" file

    However on this particular file after doing this you can't then for instance open this file in textedit, so something weird is going on with the file. Thus which editor are you using?

    In any case to work around this for you, you can simply use any of the other external diff tools out there...

    Cheers,
    Jas

  5. 5 Posted by Martin Pollow on 14 Apr, 2011 12:39 PM

    Martin Pollow's Avatar

    Hi Jason,

    thanks for your reply. The .txt file I simply created empty with "touch testfile.txt" in the terminal. Then I edited it with the terminal program "nano".
    The .m file was originally created as a MATLAB script, then edited with TextEdit.

    I just checked again. Yes, the testfile.txt does not open in the TextEdit now ("wrong encoding"), however using nano it still opens. The MATLAB file still opens here.

    > In any case to work around this for you, you can simply use any of the other external diff tools out there...

    Thanks, I will try this,
    best regards,
    Martin

  6. Support Staff 6 Posted by jason on 11 Nov, 2011 03:04 AM

    jason's Avatar

    Thanks,
    Jason

  7. jason closed this discussion on 11 Nov, 2011 03:04 AM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac