开发者

Unicode String Killed by TextBox Visual C# (not the display, the actual string)

开发者 https://www.devze.com 2023-02-03 14:24 出处:网络
I have an application that requires the display of unicode strings using a specific lookup-table-esque font.

I have an application that requires the display of unicode strings using a specific lookup-table-esque font.

This font has actual symbols for characters U+0000 to U+0020.

I have no problems building my string from a set of chars. The problem is when I try to set this string to the textbox.

Regardless of the font I choose for the textbox (the special font, or otherwise), when I do "TextBox1.Text = mycrazystring", then check the Text property of TextBox1 (which I just set), I get "", nothing.

Is this because unicode characters U+0000 to U+0020 are unsupported? Do they access functions like newline, tab, or backspace, like I suspect they do when they get placed in the text box?

If I build a string containing characters 0000 through 0023 I expect to se开发者_开发知识库e at least an exclamation mark in the TextBox1.Text property after the string is assigned to it, but no dice.

Do I need to make a custom font that shifts my current font by 0020?


Mapping Unicode characters to unrelated glyphs shouldn't be done. You can end up with lots of problems with text-layout algorithms doing inappropriate things. Mapping the control characters to custom glyphs is crazy; it will certainly confuse UI widgets and many other tools.

Do I need to make a custom font that shifts my current font by 0020?

No, you need to shift it by +E000 or more, into the Private Use Area.

0

精彩评论

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

关注公众号