开发者

If I know the font and the character, how can I programatically find the Unicode equivalent?

开发者 https://www.devze.com 2022-12-11 19:41 出处:网络
We have XML content that uses Wingdings to display ticks and possibly other characters. Our web content is generated dynamically from the XML content by an application written inDelphi.NET. It current

We have XML content that uses Wingdings to display ticks and possibly other characters. Our web content is generated dynamically from the XML content by an application written in Delphi.NET. It currently outputs <span style="font-family: Wingdings;">ü</span> which displays the tick correctly in Internet Explorer and Chrome, but displays "ü" in Firefox, Safari and Opera.

Is there a .NET function to automatically convert characters inserted in Wingdings (and other fonts) to their Unicode equivalent开发者_JAVA技巧s, or is that impossible?


There are mapping tables between Wingdings and Unicode - here's one and another - which you could use as the basis for a programmatic solution.


Is the output being displayed in Windings, or do you need to display the same symbol in standard fonts?

In the latter case you will have to apply a special conversion as in the tables already linked. In the former case, it's probably just a matter of code page conversions. I assume your XML is UTF-8 like most.

Is it generating 0xFC or some variant like &#252;/&#xfc; or the two-byte sequence 0xC3 0xBC? If it's not 0xC3 0xBC, your XML is not UTF-8, and your XML header needs to correctly define exactly what it is, e.g., ISO-8859-1. Once you have done that, ideally everyone would be able to read it correctly (assuming they're using Wingdings for that particular text.) Otherwise, you may need to explicitly convert it to UTF-8.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号