希伯来语“URL编码”在 R 中?
我已经提到了这两个函数:
?URLencode
#and
?curlEscape
我发现这两个函数都非常适合英语,但无法为希伯来语字符提供正确的翻译。
例如,这个词
我的世界
(希伯来语,和平) 应该是这样的:
%D7%A9%D7%9C%D7%95%D7%9D
但是,这两个命令都将其翻译为:
URLencode("שלום")
%f9%ec%e5%ed
您有什么建议? (我自己写的,或者有预先制作的东西)
谢谢, 塔尔
更新:我的会话信息:
> sessionInfo()
R version 2.12.0 (2010-10-15)
Platform: i386-pc-mingw32/i386 (32-bit)
locale:
[1] LC_COLLATE=Hebrew_Israel.1255 LC_CTYPE=Hebrew_Israel.1255
[3] LC_MONETARY=Hebrew_Israel.1255 LC_NUMERIC=C
[5] LC_TIME=Hebrew_Israel.1255
attached base packages:
[1] stats graphics grDevices utils datasets methods base
I've been referred to both:
?URLencode
#and
?curlEscape
I see that both functions work great for English, but fail to provide with the proper translation for Hebrew characters.
For example, the word
שלום
(Peace, in Hebrew)
Should be this:
%D7%A9%D7%9C%D7%95%D7%9D
But instead, both commands translate it to:
URLencode("שלום")
%f9%ec%e5%ed
What do you suggest? (write it myself, or is there something pre-made)
Thanks,
Tal
Update: My sessionInfo:
> sessionInfo()
R version 2.12.0 (2010-10-15)
Platform: i386-pc-mingw32/i386 (32-bit)
locale:
[1] LC_COLLATE=Hebrew_Israel.1255 LC_CTYPE=Hebrew_Israel.1255
[3] LC_MONETARY=Hebrew_Israel.1255 LC_NUMERIC=C
[5] LC_TIME=Hebrew_Israel.1255
attached base packages:
[1] stats graphics grDevices utils datasets methods base
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
URLencode 和 charToRaw 似乎都适合我......
看URLencode的源码
您使用的是哪个版本的 R?
这是我的 sessionInfo()
sessionInfo()
R版本2.10.0 (2009-10-26)
i386-pc-mingw32
区域设置:
[1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252 LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C LC_TIME=English_United States.1252
附加基础包:
[1] 统计图形 grDevices utils 数据集方法库
其他附件包:
[1] preprocessCore_1.8.0
通过命名空间加载(且未附加):
[1]tools_2.10.0
Both URLencode and charToRaw seem to work for me...
Looking at the source code of URLencode
Which version of R are you using?
Here is my sessionInfo()
sessionInfo()
R version 2.10.0 (2009-10-26)
i386-pc-mingw32
locale:
[1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252 LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C LC_TIME=English_United States.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] preprocessCore_1.8.0
loaded via a namespace (and not attached):
[1] tools_2.10.0