gpt4 book ai didi

Java 和日语字符

转载 作者:搜寻专家 更新时间:2023-11-01 02:51:12 26 4
gpt4 key购买 nike

我在我的应用程序和 JSON 中使用 Struts。当我尝试提交日文字符时,在我的 Controller 类中我得到了这样的字符串:

&#12373 ; &#12383 ; &#12399 ; &#12414 ; &#12419 ; &#12425 ;  (without spaces)

我应该将它转换为日文字符,但我找不到该怎么做!

谁能帮帮我?

最佳答案

这是 unicode 的 XML 编码。使用 Apache Commons library取消转义:

import org.apache.commons.lang.StringEscapeUtils;

String input = "さ た は ま ゃ ら";
String plain = StringEscapeUtils.unescapeXml(input);
System.out.println(plain); // Will print your characters

关于Java 和日语字符,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10799964/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com