且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在 Java 中将 UTF-8 转换为 US-Ascii

更新时间:2023-11-27 10:47:40

uni2ascii 程序是用 C 编写,但您可以毫不费力地将其转换为 Java.它包含一个很大的近似表(隐式地,在 switch-case 语句中).

The uni2ascii program is written in C, but you could probably convert it to Java with little effort. It contains a large table of approximations (implicitly, in the switch-case statements).

请注意,没有普遍接受的近似值:德国人希望您用 AE 替换 Ä,芬兰人和瑞典人更喜欢 A.您的 Å 也不是很明显:瑞典人可能会放弃戒指并使用 A,但丹麦人和挪威人可能更喜欢历史上更正确的 AA.

Be aware that there are no universally accepted approximations: Germans want you to replace Ä by AE, Finns and Swedes prefer just A. Your example of Å isn't obvious either: Swedes would probably just drop the ring and use A, but Danes and Norwegians might like the historically more correct AA better.