无法将字符串从“ UTF-8”转换为本地编码 [英] Can't convert string from 'UTF-8' to native encoding

查看:79
本文介绍了无法将字符串从“ UTF-8”转换为本地编码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我尝试在eclipse(团队->比较)中比较我的项目时,出现以下错误消息:

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

(无法从'UTF转换字符串-8'转换为本地编码)

(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
***

但是如果我运行命令:

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

,diff可以正常工作。从我所读的内容中,当客户端从存储库收到UTF-8中的字符串时,通常会发生此类错误,但并非该字符串的所有字符都可以在当前语言环境的编码中显示。 语言环境的输出为:

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=

看来eclipse不使用那些设置,还有其他方法可以在eclipse中配置语言环境设置吗?我不确定,但是也许问题与javaHL有关,在某个地方有跟踪文件吗?

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?

推荐答案

仅JavaHL SVN的包装。如我所见,JavaHL调用svn命令(svn diff ...)并解析返回的消息。您尝试执行的命令将返回该diff中某些属性已更改的信息(德语Eigenschaftsänderung)。不幸的是,处理该呼叫的终端弄乱了编码。结果是 RA层请求失败(ZM-Schicht Anforderung gescheitert),这仅表示JavaHL无法解析返回的消息。

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.

可以尝试的事情:


  1. 使用 LC_MESSAGES = en_US.UTF-8 / path / to / eclipse开始蚀/ eclipse ,也许JavaHL会调用带有英文消息的svn可执行文件

  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

检查启动Eclipse的终端。它支持unicode吗? (rxvt不会,urxvt会在其中)

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

在终端中输入ä并检查输出。您应该看到ä为可读字符。从我的输出中可以看到,字符应编码为\303\244而不是\195\164(303是195的八进制表示形式(十进制为195,而244(oct)== 164(dec))

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


希望这会有所帮助。

这篇关于无法将字符串从“ UTF-8”转换为本地编码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆