1
我正在嘗試編碼字符串以便插入到URL中。我的問題是,當我的字符串包含反斜槓時,這似乎失敗。到目前爲止,我已經嘗試了4種使用URLencode,curlEscape(來自RCurl)和curlPercentEncode(來自RCurl)函數的方法,但都沒有成功。如何URL使用R/RCurl對反斜槓進行編碼
> URLencode("hello\hello")
Error: '\h' is an unrecognized escape in character string starting ""hello\h"
> curlEscape("hello\hello")
Error: '\h' is an unrecognized escape in character string starting ""hello\h"
> curlPercentEncode("hello\hello")
Error: '\h' is an unrecognized escape in character string starting ""hello\h"
> curlPercentEncode("hello\hello", amp=TRUE)
Error: '\h' is an unrecognized escape in character string starting ""hello\h"
你試過'URLencode(「hello \\ hello」)'? – 2014-10-10 16:45:30