在JSON获取和保存字符串时,HTML code更改 [英] html code change when get in json and save in string

查看:181
本文介绍了在JSON获取和保存字符串时,HTML code更改的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在从JSON HTML code保存在web视图问题字符串和负载时保存在弦,它就会改变很多&放大器; LT和放大器; QUOT会表现出任何想法,为什么?它不会加载图像我的屏幕看起来像这样然后 http://imgur.com/KHRJjqN 我该怎么办/?如何去code呢??为什么带code呢?如何删除编码?帮助

 的WebView WV =(的WebView)findViewById(R.id.webview1);
          {状态:1,
      数据:
  [
 {PRODUCT_ID:8569
   名:地中海头皮头发长得PC-0004 .. 说明:< P>< B>< FONT FACE =宋体>头皮医学头发生长的PC-0004 ..< \\ / FONT>< \\ / B>< \\ / P>
  \\ r \\ n \\ r \\ n< P>< IMG的边界=0HEIGHT =257SRC =HTTP:\\ / \\ / www.megamall.com.pk \\ /影像\\ /缓存
 \\ /数据\\ / 10011-头皮 - 地中海 - Hairfall - 解决方案 - 800x800.jpgWIDTH =261\\ />< \\ / P> \\ r \\ n \\ r
 \\ n< P>< B><字型=宋体大小=2>
 产品特点:LT; \\ / FONT>< \\ / B>< \\ / P> \\ r \\ n \\ r \\ n< P>< FONT FACE =宋体大小=2>< B>头皮头发地中海
 成长< \\ / B>是一种全天然的配方,其中包括从植物中提取纯
 3不同的大洲< BR \\ /> \\ r \\ n< BR \\ /> \\ r \\ NIS您的秃斑越来越大
 每月< BR \\ /> \\ r \\ NIS越来越厚在你的浴室地板上的头发,而它得到
 更薄,在你头上更薄< BR \\ /> \\ r \\ n< BR \\ /> \\ r \\ n然后头皮医学头发生长
 是给你的。头皮医学头发生长是一种全天然的配方,其中包括了
 来自3大洲的不同植物提取纯。这个久经考验的配方
 将达到内心深处清洁,振兴和疏通毛囊允许至关重要
 营养成分到达发根,让头发重新生长< BR \\ /> \\ r \\ n< BR \\ /> \\ r \\ nScalp
  医学头发生长能够治疗脱发的同类产品中唯一的生态产品
 高效。在第一个月,连续使用头皮头发地中海的增长将复苏
 强化毛囊。在第二个月,你的头发会停止
 干脆吵了起来。而到了第三个月,新发开始生长。
  < \\ / FONT>< \\ / P> \\ r \\ n,
 } ]}  当得到JSON和保存字符串
          字符串htmldescription = school2.getJSONObject(0).getString(说明);         wv.loadData(htmldescription,text / html的,UTF8);
     //字符串htmldescription保存这样的数据如下
htmldescription =   &放大器; LT; P&放大器; GT;&放大器; LT; B和; GT;&放大器; LT;字型=安培; QUOT;宋体和放大器; QUOT;&放大器; GT;头皮医学头发生长的PC-0004 ..
   &放大器; LT; / FONT&放大器; GT;&放大器; LT; / B&放大器; GT;&放大器; LT; / P&放大器; GT; &放大器;所述; P&放大器; GT;&放大器;所述; IMG边界=安培; QUOT 0安培; QUOT;高度=安培;
   QUOT; 257安培; QUOT;
   SRC =&放大器; QUOT; HTTP://www.megamall.com.pk/image/cache/data/10011-Scalp-Med-Hairfall-Solution-
   800x800.jpg&安培; QUOT;宽度=安培; QUOT; 261安培; QUOT; /&放大器; GT;&放大器;所述; / P&放大器; GT;
  &放大器; LT; P&放大器; GT;&放大器; LT; B和; GT;&放大器; LT;字型=安培; QUOT;宋体和放大器; QUOT;大小=安培; QUOT; 2及QUOT;&放大器; GT;特点:
  &放大器; LT; / FONT&放大器; GT;&放大器; LT; / B&放大器; GT;&放大器; LT; / P&放大器; GT;&放大器; LT; P&放大器; GT;&放大器; LT;字型=安培; QUOT;宋体和放大器; QUOT;
 大小=安培; QUOT; 2及QUOT;&放大器; GT;&放大器; LT; B和; GT;头皮医学头发生长和放大器; LT; / B&放大器; GT;
 是一种全天然的配方,其中包括3种不同的植物提取纯
 大陆和放大器; LT; BR /&放大器; GT;&放大器; LT; BR /&放大器; GT;是您的秃斑越来越大的每
 ?月和放大器; LT; BR /&放大器; GT;就在你的浴室地板上的头发越来越厚,而它变得更薄,
 薄在你的头上和放大器; LT; BR /&放大器; GT;&放大器; LT; BR /&放大器; GT;
 然后头皮医学头发生长是给你的。头皮医学头发生长是一种全天然的
 配方包括植物从3不同的大洲纯提取物。这个
 久经考验的制定将达到内心深处清洁,振兴和疏通头发
毛囊使重要的营养物质到达发根,让头发重新生长和放大器; LT; BR
/&放大器; GT;&放大器; LT; BR /&放大器; GT;
 头皮医学头发长是同类产品能够唯一生态产品
 有效治疗脱发。在第一个月,连续使用头皮医学头发的生长意志
 恢复并强化毛囊。在第二个月,你的头发会
 完全停止吵了起来。而到了第三个月,新的头发将开始
 成长&放大器;所述; /字体&放大器; GT;&放大器;所述; / P&放大器; gt;中


解决方案

尝试看看文档的 http://developer.android.com/reference/android/text/Html.html

I am getting HTML code from JSON save in string and load in webView problem is when save in string it will change so many &lt &quot will shown any idea why? its not load image my screen look like this then http://imgur.com/KHRJjqN what will i do/? how to decode it?? why is encode it? how to remove encoding? help

             WebView      wv = (WebView) findViewById(R.id.webview1);




          {"Status":1,
      "data":
  [
 {"product_id":"8569",




   "name":"Scalp Med Hair Grow PC-0004..",

 "description":"<p><b><font face="Arial">Scalp Med Hair Grow PC-0004.. <\/font><\/b><\/p>    
  \r\n\r  \n<p><img border="0" height="257"  src="http:\/\/www.megamall.com.pk\/image\/cache  
 \/data\/10011-Scalp-Med-Hairfall-Solution- 800x800.jpg" width="261" \/><\/p>\r\n\r 
 \n<p><b><font face="Arial" size="2">
 Features: <\/font><\/b><\/p>\r\n\r\n<p><font face="Arial" size="2"><b>Scalp Med Hair 
 Grow<\/b>    is an all natural formulation which includes the pure extracts of plants from 
 3 different continents.<br \/>\r\n<br \/>\r\nIs your Bald Spot getting bigger and bigger 
 every   month?<br \/>\r\nIs the hair on your shower floor getting thicker while it gets
 thinner and thinner on your head?<br \/>\r\n<br \/>\r\nThen Scalp Med Hair Grow
 is for you. Scalp Med Hair Grow is an all natural formulation which includes the
 pure extracts of plants from 3 different continents. This tried and tested formulation
 will reach deep down to cleanse, revitalize and unblock the hair follicles allowing vital   
 nutrients to reach the hair roots and allow hair to grow again.<br \/>\r\n<br \/>\r\nScalp
  Med Hair Grow is the only ecological product of its kind capable of treating alopecia 
 efficiently. In the first month, continual use of Scalp Med Hair Grow will recover
 and strengthen the hair follicles. In the second month, your hair will stop 
 falling out altogether. And by the third month, new hair will start to grow.
  <\/font><\/p>\r\n",


 }

 ]}

  when get in json and save in string 


          String   htmldescription = school2.getJSONObject(0).getString("description");

         wv.loadData(htmldescription, "text/html", "utf8");


     // String htmldescription  save data like this below


htmldescription ="

   &lt;p&gt;&lt;b&gt;&lt;font face=&quot;Arial&quot;&gt;Scalp Med Hair Grow PC-0004..     
   &lt;/font&gt;&lt;/b&gt;&lt;/p&gt; &lt;p&gt;&lt;img border=&quot;0&quot; height=&     
   quot;257&quot; 
   src=&quot;http://www.megamall.com.pk/image/cache/data/10011-Scalp-Med-Hairfall-Solution-   
   800x800.jpg&quot; width=&quot;261&quot; /&gt;&lt;/p&gt;
  &lt;p&gt;&lt;b&gt;&lt;font face=&quot;Arial&quot; size=&quot;2&quot;&gt;Features:  
  &lt;/font&gt;&lt;/b&gt;&lt;/p&gt;&lt;p&gt;&lt;font face=&quot;Arial&quot; 
 size=&quot;2&quot;&gt;&lt;b&gt;Scalp Med Hair Grow&lt;/b&gt; 
 is an all natural formulation which includes the pure extracts of plants from 3 different    
 continents.&lt;br /&gt;&lt;br /&gt;Is your Bald Spot getting bigger and bigger every
 month?&lt;br /&gt;Is the hair on your shower floor getting thicker while it gets thinner and   
 thinner on your head?&lt;br /&gt;&lt;br /&gt;
 Then Scalp Med Hair Grow is for you. Scalp Med Hair Grow is an all natural 
 formulation which includes the pure extracts of plants from 3 different continents. This 
 tried  and tested formulation will reach deep down to cleanse, revitalize and unblock the hair 
follicles allowing vital nutrients to reach the hair roots and allow hair to grow again.&lt;br  
/&gt;&lt;br /&gt;
 Scalp Med Hair Grow is the only ecological product of its kind capable of
 treating alopecia efficiently. In the first month, continual use of Scalp Med Hair Grow will   
 recover and strengthen the hair follicles. In the second month, your hair will 
 stop falling out altogether. And by the third month, new hair will start to     
 grow.&lt;/font&gt;&lt;/p&gt;"

解决方案

Try have a look at documentation http://developer.android.com/reference/android/text/Html.html

这篇关于在JSON获取和保存字符串时,HTML code更改的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆