Display \u0096 in a jsp

后端 未结 1 1564
花落未央
花落未央 2021-01-21 04:46

I\'m trying to display a character stored in a database that is the unicode character \\u0096. Because of a strange windows-vs-web-browser thing this is a control character in t

相关标签:
1条回答
  • 2021-01-21 05:53

    The character denoted by \0096, i.e. U+0096, is unambiguously a control character in Unicode, with undefined meaning. This should not be confused with the fact that in the windows-1252 encoding, the byte 0x96 denotes U+2013 EN DASH.

    Thus, instead of trying to render an invisible character as visible, you should simply replace U+0096 by U+2013 or, depending on the actual setup, perhaps convert the data you get from the database, converting from windows-1252 to e.g. UTF-16. It is unlikely that the database contains something meant to be U+0096. Rather, it contains bytes that are now being misinterpreted as UTF-16 but are actually windows-1252 encoded representations of characters.

    0 讨论(0)
提交回复
热议问题