0

当我们在 JSP 上使用 MS Word 撇号 [you're] 显示文本时,它会被替换为 ? [你是] 。请帮助我找到将 MS Word 撇号 [you're] 替换为普通文本撇号 [you're] 的解决方案。

4

2 回答 2

0
于 2012-08-08T18:30:16.940 回答
0

如果您使用od或类似的,您可以转储有问题的文件并确定您要替换的字符的代码。然后,您可以将 Java 正则表达式与以下表示字符代码的模式之一一起使用:

\0n     The character with octal value 0n (0 <= n <= 7)
\0nn    The character with octal value 0nn (0 <= n <= 7)
\0mnn   The character with octal value 0mnn (0 <= m <= 3, 0 <= n <= 7)
\xhh    The character with hexadecimal value 0xhh
\uhhhh  The character with hexadecimal value 0xhhhh

例如

String replaced = oldString.replaceAll("\u1234", ","); // where 1234 is your character code
于 2012-08-08T11:57:03.743 回答