Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
714 views
in Technique[技术] by (71.8m points)

eclipse - Git error: Malformed input or input contains unmappable chacraters

My Eclipse workspace has two projects, one using CVS, the other Git. When modifying a file in the CVS project and save, a pop-up window appear saying

An internal error occurred during: "Computing Git status for repository repo23".
Malformed input or input contains unmappable chacraters: /Users/pb/repo23/对照表/feng11.htm

Any idea how to fix this?

EDIT:

Eclipse Platform

Version: 4.3.1.v20130911-1000 Build id: M20130911-1000

Eclipse EGit 3.2.0.201312181205-r

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

You can see the exact call stack in this issue:

java.nio.file.InvalidPathException: Malformed input or input contains unmappable chacraters: /Users/jettykoo/Desktop/WeTeam/Git/WSS/MaryKay/Doc/01/.DS_Store
    at sun.nio.fs.UnixPath.encode(UnixPath.java:147)
    at sun.nio.fs.UnixPath.<init>(UnixPath.java:71)
    at sun.nio.fs.UnixFileSystem.getPath(UnixFileSystem.java:281)
    at java.io.File.toPath(File.java:2186)
    at org.eclipse.jgit.util.FileUtil.isFile(FileUtil.java:126)
    at org.eclipse.jgit.util.FileUtil.canExecute(FileUtil.java:131)

I was surprised by the typo in sun/nio/fs/UnixPath.java : 'chacraters' instead of 'characters'!

As mentioned in this NetBeans issue (which should be relevant in an Eclipse context):

it's a JDK issue and also partially also Apple issue (the LC_CTYPE is not set by default).
The behaviour in terminal depends on the Terminal.app preferences.

  • When the Terminal export LC_CTYPE set to UTF-8 it works fine in terminal as the sun.jnu.encoding is set to the value of LC_CTYPE.
  • When it's not set it does not work.

The problem with setting the sun.jnu.encoding is that it may be overwritten by the JDK, so it's safer to export the LC_CTYPE=UTF-8.

Rather then addding -J-Dsun.jnu.encoding=UTF-8 to netbeans.conf, prepend the export LC_CTYPE=UTF-8 to it.

You could set this in your eclipse.ini (-DLC_CTYPE=UTF-8).


Alexander Kachkaev mentions in the comments:

What helped me was adding two lines to eclipse.ini.

-DLC_CTYPE=UTF-8
-Dfile.encoding=UTF-8

Team commands stopped giving errors


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...