android - Replace some special characters with browser code -
i facing strange situation here.
i parsing image link through json , getting url:
http://developersatwork.com/projects/g4/tools/wp-content/uploads/2015/05/belbin’s-team-roles-100x100.jpg
whenever paste in browser image showing,but whenever paste in notepad following url showing up:
http://developersatwork.com/projects/g4/tools/wp-content/uploads/2015/05/belbin%e2%80%99s-team-roles-100x100.jpg
as can apostrophe replaced %e2%80%99 , json cannot detect apostrophe , result throwing exception:
06-15 14:01:16.955: w/system.err(10146): java.io.filenotfoundexception: http://developersatwork.com/projects/g4/tools/wp-content/uploads/2015/05/belbin’s-team-roles-100x100.jpg
how can replace such special characters corresponding code json can detect them??
i tried utf-8 encoding , decoding not working.please give generalised solution not specific character.
another one:
http://www.tools4management.dreamhosters.com/wp-content/uploads/2015/06/the-positive-model-of-coaching-–-an-8-step-outline-to-motivate-goal-accomplishment-100x100.jpg
but when paste link browser notepad shows:
http://www.tools4management.dreamhosters.com/wp-content/uploads/2015/06/the-positive-model-of-coaching-%e2%80%93-an-8-step-outline-to-motivate-goal-accomplishment-100x100.jpg
solution
the workaround use webview instead of imageview.
you need decode url.
url = java.net.urldecoder.decode(url, "utf-8");
Comments
Post a Comment