[英]how to convert unicode characters to actual characters in java?
我要输入两个字符串:1.簿记表格2.霍奇金病
我想用&替换\\\\ u0026并用'替换\\ u0027。 一种方法是用相应的符号替换它们的出现,但是有没有通用的方法来解决此问题?
我的建议是Apache StringScapeUtils
特别是unescapeJava
方法。
网站: https : //commons.apache.org/proper/commons-lang/
Maven回购: https : //mvnrepository.com/artifact/org.apache.commons/commons-lang3
该方法将unicode转换为可读文本,例如:
String stringWithUnicode; //For example "tendr\\u00e1"
StringScapeUtils.unescapeJava(stringWithUnicode); //This call returns: Tendrá
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.