Can't convert string from 'UTF-8' to native encoding

拥有回忆 提交于 2019-12-10 01:52:18

问题


I am getting the following error message when I try to compare my project in eclipse (Team->Compare):

(Can't convert string from 'UTF-8' to native encoding)

***
diff --old /Users/admin/Documents/workspace_branch_2.8/Test --new https://192.168.1.202/svn/main_repository/tenios/Voxtelo/bundle/trunk/Server/Test
    Invalid argument
svn: Kann Zeichenkette nicht von »UTF-8« in die eigene Codierung konvertieren:
svn: 
Eigenschafts?\195?\164nderungen: /Users/admin/Documents/workspace_branch_2.8/Test/src/main/java/org/test/test/internal/commands/Command.java

ZM-Schicht Anforderung gescheitert
svn: Fehler beim Lesen der Antwort auf die REPORT Anfrage von Festplatte
***

However if I run the command:

svn diff --old /Users/admin/Documents/workspace_branch_2.8/Test --new https://192.168.1.202/svn/main_repository/tenios/Voxtelo/bundle/trunk/Server/Test

using command line on mac os, the diff is working without problems. From what I have read, errors like this typically occur when the client has received a string in UTF-8 from the repository, but not all the characters of that string can be displayed in the encoding of the current locale. The output of "locale" is:

LANG="de_DE.UTF-8"
LC_COLLATE="de_DE.UTF-8"
LC_CTYPE="de_DE.UTF-8"
LC_MESSAGES="de_DE.UTF-8"
LC_MONETARY="de_DE.UTF-8"
LC_NUMERIC="de_DE.UTF-8"
LC_TIME="de_DE.UTF-8"
LC_ALL=

It seems that eclipse does not use those settings, is there an other way to configure locale settings in eclipse? I'm not sure, but maybe the problem is related to javaHL, is there a trace file somewhere?


回答1:


JavaHL is only a wrapper to SVN. As i see it JavaHL calls the svn command (svn diff...) and parses the returned message. The command you try to execute returns the info that in this diff some property changed (in german Eigenschaftsänderung). Unfortunately the terminal which handled the call messed up the encoding. The result is a "RA layer request failed" (ZM-Schicht Anforderung gescheitert) which simply means that JavaHL was not able to parse the returned message.

Things you can try:

  1. start eclipse with LC_MESSAGES="en_US.UTF-8" /path/to/eclipse/eclipse and maybe JavaHL will call the svn executable with english messages

  2. check the terminal from which you start Eclipse. Does it support unicode? (rxvt does not, where urxvt does)

    type ä in your terminal and check the output. You should see the ä as readable character. As you can see from my output the character should be encoded as \303\244 and not \195\164 (303 is the octal representation for 195 in decimal, and 244(oct) == 164(dec))

    $ ä
    bash: $'\303\244': command not found
    

Hope this helps.



来源:https://stackoverflow.com/questions/11869475/cant-convert-string-from-utf-8-to-native-encoding

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!