我有以下字符串:
Conversely, companies that aren\u0019t sharp-eyed enough to see that their real Dumbwaiter Pitches are lame, tired, or just plain evil \u0014 well, they usually end up facing extinction.
此字符串包含“\u0019t”。我无法解码,因为它已经是一个字符串了。如果我先编码,然后解码,它仍然显示“\u0019t”。我怎样才能让它显示一个'
一种选择是对其进行文字评估:
输出:
不知何故,Unicode转义字符串偏离了2000个十六进制。Unicode破折号和撇号是:
Unicode Character 'EM DASH' (U+2014)
及
Unicode Character 'RIGHT SINGLE QUOTATION MARK' (U+2019)
因此,不管怎样,让我们修复它,即使错误在源(他们)而不是目标:
打印出来
请注意,尽管我很高兴地忽略了文本中可能存在的
\\u00xx
(反斜杠本身转义),但这是我留给您解决的问题。当然,文本中任何正确的Unicode转义也将被更改相关问题 更多 >
编程相关推荐