localization - Work with the link with special character (e.g. traditional chinese , empty space) in android -
i working special character in url android
however, encounter 2 problem
1) empty space
if have query inside url
e.g. test.php?test=aaa bbbb cccc
then query not include bbbb , cccc, learnt should replace " " %20, however, instead of using replace(" ","%20")
, how can in more standard way?
2) traditional chinese in url
i have image url this:
http://oshc.zizsoft.com/wp-content/uploads/2014/04/1-職安健資訊產品目錄2013-220x300.png
if directly pass android, fail. if copy link desktop browser , change this, paste on android, works
"http://oshc.zizsoft.com/wp-content/uploads/2014/04/1-%e8%81%b7%e5%ae%89%e5%81%a5%e8%b3%87%e8%a8%8a%e7%94%a2%e5%93%81%e7%9b%ae%e9%8c%842013-220x300.png";
what should encode this?
thanks helping
update:
it change
http%3a%2f%2foshc.zizsoft.com%2fwp-content%2fuploads%2f2013%2f12%2fsq1-351x300.jpg
how can fix that? thanks
1) try trimming url, wil remove spaces url. guess bit more staanddard way solve issue.
2) problem eactly due encoding issues. our android default encoding cp1252...and strings not encoded in same way when used in code automatically changes other symbols. try changing encoding of project , string same utf-8 or something. can change project encoding properties> resources> encoding
hope suggesions bit.
Comments
Post a Comment