Perl 5 在 CPAN 上有一个名为Text::Unidecode
将 Unicode 音译为 ASCII 的模块。因此,例如,如果您将 string"“北亰 — it’s the best”"
交给它,它会将 string 交回"\"Bei Jing -- it's the best\""
。快速搜索 Java 库来做同样的事情只会发现会去除 Unicode 字符或将重音字符转换为非重音字符的代码。
有谁知道产生类似输出的 Java 库Text::Unidecode
?
Perl 5 在 CPAN 上有一个名为Text::Unidecode
将 Unicode 音译为 ASCII 的模块。因此,例如,如果您将 string"“北亰 — it’s the best”"
交给它,它会将 string 交回"\"Bei Jing -- it's the best\""
。快速搜索 Java 库来做同样的事情只会发现会去除 Unicode 字符或将重音字符转换为非重音字符的代码。
有谁知道产生类似输出的 Java 库Text::Unidecode
?
一个快速的谷歌说: http: //junidecode.sourceforge.net/ - 但看起来它已经有一段时间没有更新了。
Java 还有另一个库:unidecode。
与 Gradle 一起使用:
compile 'cz.jirutka.unidecode:unidecode:1.0.1'
与 Maven 一起使用:
<dependency>
<groupId>cz.jirutka.unidecode</groupId>
<artifactId>unidecode</artifactId>
<version>1.0.1</version>
</dependency>