Delphi XE AnsiStrings与转义的组合变音符号 [英] Delphi XE AnsiStrings with escaped combining diacritical marks
问题描述
将Delphi XE AnsiString转换为Fu\0308rst的转义合并变音符号到最简单的WideStringFürst中的最佳方式是什么?
What is the best way to convert a Delphi XE AnsiString containing escaped combining diacritical marks like "Fu\u0308rst" into a frienly WideString "Fürst"?
我知道这并不总是可能的所有组合,但普遍的拉丁方块应该支持,而不建立愚蠢的转换表我自己。我想这个解决方案可以在新的Characters单元中找到,但是我不明白。
I am aware of the fact that this is not always possible for all combinations, but the common Latin blocks should be supported without building silly conversion tables on my own. I guess the solution can be found somewhere in the new Characters unit, but I don't get it.
推荐答案
我想你需要在您的字符串上执行 Unicode规范化。
I think you need to perform Unicode Normalization. on your string.
我不知道Delphi XE RTL中是否有一个特定的调用来执行此操作,但WinAPI调用 NormalizeString 应该在这里帮助你,模式NormalizationKC:
I don't know if there's a specific call in Delphi XE RTL to do this, but the WinAPI call NormalizeString should help you here, with mode NormalizationKC:
NormalizationKC
NormalizationKC
Unicode归一化形式KC,兼容性组合。转换
每个基础加上组合字符到
规范的预设等价的
和所有兼容性字符到
他们的等价物。例如,结扎fi成为f + i;同样,A +¨+ fi + n变为Ä+ f + i + n。
Unicode normalization form KC, compatibility composition. Transforms each base plus combining characters to the canonical precomposed equivalent and all compatibility characters to their equivalents. For example, the ligature fi becomes f + i; similarly, A + ¨ + fi + n becomes Ä + f + i + n.
这篇关于Delphi XE AnsiStrings与转义的组合变音符号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!