如何取消转义& #xfc;到? [英] How to unescape ü to ü?

查看:65
本文介绍了如何取消转义& #xfc;到?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将XML字符实体引用& #xfc; 转换为Java中的ü.
我该如何实现?

I would like to unescape a XML character entity reference ü to ü in Java.
How can I achieve this?

推荐答案

可能您需要一个额外的库来将该代码转换为Unicode字符,例如 StringEscapeUtils .

Probably you need an additional library to convert that codes to Unicode chars, like Apache Commons Lang. This library has the class StringEscapeUtils.

import org.apache.commons.lang3.StringEscapeUtils;

public class Unescape {
    public static void main(String[] args) {
        String str = StringEscapeUtils.unescapeHtml4("ü");
        System.out.println(str);
    }
}

输出:

ü

这篇关于如何取消转义& #xfc;到?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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