码迷,mamicode.com
首页 > 其他好文 > 详细

XML中对特殊字符的处置

时间:2015-01-06 19:45:37      阅读:176      评论:0      收藏:0      [点我收藏+]

标签:

                           str = str.replaceAll("‘", "‘");
			str = str.replaceAll("’", "‘");
			str = str.replaceAll("“", "”");
			str = str.replaceAll("”", "”");
			str = str.replaceAll("—", "—");		
			str = str.replaceAll("¢","¢");
			str = str.replaceAll("£","£");
			str = str.replaceAll("¤","¤");
			str = str.replaceAll("¥","¥");
			str = str.replaceAll("¦","|");
			str = str.replaceAll("§","§");
			str = str.replaceAll("¨","¨");
			str = str.replaceAll("ª","a");
			str = str.replaceAll("­","-");
			str = str.replaceAll("¯","ˉ");
			str = str.replaceAll("°","°");
			str = str.replaceAll("±","±");
			str = str.replaceAll("µ","μ");
			str = str.replaceAll("·","·");
			str = str.replaceAll("¹","1");
			str = str.replaceAll("º","o");
			str = str.replaceAll("×","×");
			str = str.replaceAll("÷","÷");
			str = str.replaceAll("…","…");
			str = str.replaceAll("‾"," ̄");
			str = str.replaceAll("←","←");
			str = str.replaceAll("↑","↑");
			str = str.replaceAll("→","→");
			str = str.replaceAll("↓","↓");
			str = str.replaceAll("∏","∏");
			str = str.replaceAll("∑","∑");
			str = str.replaceAll("√","√");
			str = str.replaceAll("∝","∝");
			str = str.replaceAll("∞","∞");
			str = str.replaceAll("∠","∠");
			str = str.replaceAll("∧","∧");
			str = str.replaceAll("∨","∨");
			str = str.replaceAll("∩","∩");
			str = str.replaceAll("∪","∪");
			str = str.replaceAll("∫","∫");
			str = str.replaceAll("∴","∴");
			str = str.replaceAll("∼","~");
			str = str.replaceAll("≈","≈");
			str = str.replaceAll("≠","≠");
			str = str.replaceAll("≡","≡");
			str = str.replaceAll("≤","≤");
			str = str.replaceAll("≥","≥");
			str = str.replaceAll("⊕","?");
			str = str.replaceAll("⊥","⊥");
			str = str.replaceAll("–","–");
			str = str.replaceAll("—","—");
			str = str.replaceAll("‰","‰");
			str = str.replaceAll("€","?");
			str = str.replaceAll("À","à");
			str = str.replaceAll("Á","á");
			str = str.replaceAll("È","è");
			str = str.replaceAll("É","é");
			str = str.replaceAll("Ê","ê");
			str = str.replaceAll("Ì","ì");
			str = str.replaceAll("Í","í");
			str = str.replaceAll("Ð","D");
			str = str.replaceAll("Ò","ò");
			str = str.replaceAll("Ó","ó");
			str = str.replaceAll("Ù","ù");
			str = str.replaceAll("Ú","ú");
			str = str.replaceAll("Ü","ü");
			str = str.replaceAll("Ý","Y");
			str = str.replaceAll("Þ","T");
			str = str.replaceAll("à","à");
			str = str.replaceAll("á","á");
			str = str.replaceAll("â","a");
			str = str.replaceAll("è","è");
			str = str.replaceAll("é","é");
			str = str.replaceAll("ê","ê");
			str = str.replaceAll("ì","ì");
			str = str.replaceAll("í","í");
			str = str.replaceAll("ð","e");
			str = str.replaceAll("ò","ò");
			str = str.replaceAll("ó","ó");
			str = str.replaceAll("ù","ù");
			str = str.replaceAll("ú","ú");
			str = str.replaceAll("ü","ü");
			str = str.replaceAll("ý","y");
			str = str.replaceAll("þ","t");
			str = str.replaceAll("Α","Α");
			str = str.replaceAll("Β","Β");
			str = str.replaceAll("Γ","Γ");
			str = str.replaceAll("Δ","Δ");
			str = str.replaceAll("Ε","Ε");
			str = str.replaceAll("Ζ","Ζ");
			str = str.replaceAll("Η","Η");
			str = str.replaceAll("Θ","Θ");
			str = str.replaceAll("Ι","Ι");
			str = str.replaceAll("Κ","Κ");
			str = str.replaceAll("Λ","Λ");
			str = str.replaceAll("Μ","Μ");
			str = str.replaceAll("Ν","Ν");
			str = str.replaceAll("Ξ","Ξ");
			str = str.replaceAll("Ο","Ο");
			str = str.replaceAll("Π","Π");
			str = str.replaceAll("Ρ","Ρ");
			str = str.replaceAll("Σ","Σ");
			str = str.replaceAll("Τ","Τ");
			str = str.replaceAll("Υ","Υ");
			str = str.replaceAll("Φ","Φ");
			str = str.replaceAll("Χ","Χ");
			str = str.replaceAll("Ψ","Ψ");
			str = str.replaceAll("Ω","Ω");
			str = str.replaceAll("α","α");
			str = str.replaceAll("β","β");
			str = str.replaceAll("γ","γ");
			str = str.replaceAll("δ","δ");
			str = str.replaceAll("ε","ε");
			str = str.replaceAll("ζ","ζ");
			str = str.replaceAll("η","η");
			str = str.replaceAll("θ","θ");
			str = str.replaceAll("ι","ι");
			str = str.replaceAll("κ","κ");
			str = str.replaceAll("λ","λ");
			str = str.replaceAll("μ","μ");
			str = str.replaceAll("ν","ν");
			str = str.replaceAll("ξ","ξ");
			str = str.replaceAll("ο","ο");
			str = str.replaceAll("π","π");
			str = str.replaceAll("ρ","ρ");
			str = str.replaceAll("σ","σ");
			str = str.replaceAll("τ","τ");
			str = str.replaceAll("υ","υ");
			str = str.replaceAll("φ","φ");
			str = str.replaceAll("χ","χ");
			str = str.replaceAll("ψ","ψ");
			str = str.replaceAll("ω","ω");			
			str = str.replaceAll("´","?");
			str = str.replaceAll("©","?");
			str = str.replaceAll("µ","?");
			str = str.replaceAll("®","?");
			str = str.replaceAll("°","°");
			str = str.replaceAll("¡","?");
			str = str.replaceAll("»","?");
			str = str.replaceAll("¦","?");
			str = str.replaceAll("÷","÷");
			str = str.replaceAll("¿","?");
			str = str.replaceAll("¬","?");
			str = str.replaceAll("§","§");
			str = str.replaceAll("•","?");
			str = str.replaceAll("½","?");
			str = str.replaceAll("«","?");
			str = str.replaceAll("¶","?");
			str = str.replaceAll("¨","¨");
			str = str.replaceAll("¸","?");
			str = str.replaceAll("¼","?");
			str = str.replaceAll("±","±");
			str = str.replaceAll("×","×");
			str = str.replaceAll("¢","?");
			str = str.replaceAll("¾","?");
			str = str.replaceAll("¯","?");
			str = str.replaceAll("™","?");
			str = str.replaceAll("€","?");
			str = str.replaceAll("£","?");
			str = str.replaceAll("¥","?");
			str = str.replaceAll("„","?");
			str = str.replaceAll("…","…");
			str = str.replaceAll("·","·");
			str = str.replaceAll("›","?");
			str = str.replaceAll("ª","?");
			str = str.replaceAll("ˆ","?");
			str = str.replaceAll("º","?");
			str = str.replaceAll("†","?");
			str = str.replaceAll("‹","?");
			str = str.replaceAll("‚","?");
			str = str.replaceAll("‰","‰");
			str = str.replaceAll("­","?");
			str = str.replaceAll("˜","?");
			str = str.replaceAll("≈","≈");
			str = str.replaceAll("⁄","?");
			str = str.replaceAll("←","←");
			str = str.replaceAll("∂","?");
			str = str.replaceAll("♠","?");
			str = str.replaceAll("∩","∩");
			str = str.replaceAll("≥","≥");
			str = str.replaceAll("≤","≤");
			str = str.replaceAll("∑","∑");
			str = str.replaceAll("♣","?");
			str = str.replaceAll("⇔","?");
			str = str.replaceAll("◊","?");
			str = str.replaceAll("′","′");
			str = str.replaceAll("↑","↑");
			str = str.replaceAll("↓","↓");
			str = str.replaceAll("♥","?");
			str = str.replaceAll("−","?");
			str = str.replaceAll("∏","∏");
			str = str.replaceAll("‍","?");
			str = str.replaceAll("♦","?");
			str = str.replaceAll("∞","∞");
			str = str.replaceAll("≠","≠");
			str = str.replaceAll("√","√");
			str = str.replaceAll("‌","?");
			str = str.replaceAll("≡","≡");
			str = str.replaceAll("∫","∫");
			str = str.replaceAll("‾","?");
			str = str.replaceAll("→","→");
			str = str.replaceAll("α","α");
			str = str.replaceAll("η","η");
			str = str.replaceAll("μ","μ");
			str = str.replaceAll("π","π");
			str = str.replaceAll("θ","θ");
			str = str.replaceAll("β","β");
			str = str.replaceAll("γ","γ");
			str = str.replaceAll("ν","ν");
			str = str.replaceAll("ψ","ψ");
			str = str.replaceAll("υ","υ");
			str = str.replaceAll("χ","χ");
			str = str.replaceAll("ι","ι");
			str = str.replaceAll("ω","ω");
			str = str.replaceAll("ρ","ρ");
			str = str.replaceAll("ξ","ξ");
			str = str.replaceAll("δ","δ");
			str = str.replaceAll("κ","κ");
			str = str.replaceAll("ο","ο");
			str = str.replaceAll("σ","σ");
			str = str.replaceAll("ζ","ζ");
			str = str.replaceAll("ε","ε");
			str = str.replaceAll("λ","λ");
			str = str.replaceAll("φ","φ");
			str = str.replaceAll("τ","τ");
			str = str.replaceAll("Α","Α");
			str = str.replaceAll("Η","Η");
			str = str.replaceAll("Μ","Μ");
			str = str.replaceAll("Π","Π");
			str = str.replaceAll("Θ","Θ");
			str = str.replaceAll("Β","Β");
			str = str.replaceAll("Γ","Γ");
			str = str.replaceAll("Ν","Ν");
			str = str.replaceAll("Ψ","Ψ");
			str = str.replaceAll("Υ","Υ");
			str = str.replaceAll("Χ","Χ");
			str = str.replaceAll("Ι","Ι");
			str = str.replaceAll("Ω","Ω");
			str = str.replaceAll("Ρ","Ρ");
			str = str.replaceAll("Ξ","Ξ");
			str = str.replaceAll("Δ","Δ");
			str = str.replaceAll("Κ","Κ");
			str = str.replaceAll("Ο","Ο");
			str = str.replaceAll("Σ","Σ");
			str = str.replaceAll("Ζ","Ζ");
			str = str.replaceAll("Ε","Ε");
			str = str.replaceAll("Λ","Λ");
			str = str.replaceAll("Φ","Φ");
			str = str.replaceAll("Τ","Τ");
			str = str.replaceAll("ς","?");


参考原文:http://www.myexception.cn/xml-soap/1049053.html

XML中对特殊字符的处置

标签:

原文地址:http://www.cnblogs.com/liuwj/p/4206625.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!