How to escape the url encoding in URLWRITE
조회 수: 4 (최근 30일)
이전 댓글 표시
Hi
I've encountered a slight problem trying to use URLWRITE with 'get' parameters.
keyStr = 'Fmjtd%7Cluubnuur2h%xxxxxxxxxxx'; % not a real key
params = {'key' keyStr};
Now with appropriate url and filename I try:
[~,status] = urlwrite(url,filename,'get',params);
But URLWRITE calls java.net.URLEncoder.encode on the params so %'s are turned into %25, and of course the key fails.
How can I escape the url encoding? I've tried '%%' and '\%' but neither work.
Any ideas appreciated.
Neil
댓글 수: 2
Walter Roberson
2013년 10월 18일
Is the %7C intended to be interpreted on the other end as literally '%' '7' 'C', or is it intended that the other end decode it to character #252 ?
채택된 답변
Friedrich
2013년 10월 21일
Hi,
"All other characters are unsafe and are first converted into one or more bytes using some encoding scheme. Then each byte is represented by the 3-character string "%xy", where xy is the two-digit hexadecimal representation of the byte."
Seems like you need your own customized version of urlwrite here.
댓글 수: 4
Walter Roberson
2013년 10월 22일
I would substitute char(252) for the %7C in your string, and then let the url encoder transform it to %7c
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Startup and Shutdown에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!