Richtextbox .rtf函数中的UTF-8问题 [英] UTF-8 issue in .rtf function of richtextbox

查看:82
本文介绍了Richtextbox .rtf函数中的UTF-8问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,


我在将utf8字符传递到richtextbox对象的.rtf函数时遇到问题

例如:
------------------
昏暗的utf8作为字符串=棕色brown狐狸快速跳动
richtextbox.rtf = utf8
-------------------

在上述情况下,一旦您查看RichTextBox,the将转换为一个问号.

任何人都可以建议将utf8字符传递到richtextbox的.rtf函数后如何完美呈现?

我需要在.rtf中传递它,因为我需要保持每个单词的强调类型.

谢谢
Chaegie

Hi everyone,


I have a problem in passing utf8 character into .rtf function of richtextbox object

example:
------------------
Dim utf8 as String = the quick brown Ǣ fox jump
richtextbox.rtf = utf8
-------------------

In above scenario, once you view the richtextbox, the Ǣ will be converted into one question mark.

anybody can suggest on how to perfectly render the utf8 characters upon passing it into the .rtf function of richtextbox?

I need to pass it in .rtf since i need to maintain the emphasis type of each word.

Thank you,
Chaegie

推荐答案

我发现了:RTF是该死的古玩!

它可以与Unicode一起使用,但可以根据代码页(自Windows 95及更早版本)在内部以旧Windows格式进行内部转换,每个字符8位,但是文本片段以Windows代码为前缀.当我在写字板中键入Unicode字符(高于FF的代码点)时,我看到了这种编码.如果还支持Unicode转义,例如\u1234?.对于不支持Unicode的程序,?"表示回退("show?").此外,RTF也不以任何方式支持BOM以外的代码点(据我所记得,Windows所有新版本都通过代理对支持代码点,因为Windows 2000的某些Service Pack).

您可以简单地尝试在写字板中键入所需的内容,保存文件并使用纯文本编辑器打开它,以确保您了解应如何编码所有详细信息.我就是这么做的.

请参见 http://en.wikipedia.org/wiki/Rich_Text_Format [
I found it: RTF is damn archaic!

It works with Unicode but internally convert it in legacy Windows format based on code pages (as of Windows 95 and earlier), 8 bits per characters, but the fragment of text is prefixed with the Windows code. I saw this encoding when I types Unicode characters (code points above FF) in WordPad. If also supports Unicode escapes like \u1234?. The question marks denoted fallback for the programs not supporting Unicode ("show ?"). Also RTF does not support code points beyond BOM in any way (by all new versions of Windows do support it via surrogate pairs; as far as I remember — since some service pack of Windows 2000).

You can simply try type what you need in WordPad, save the file and open it with the plain-text editor, to make sure your understand how it should be coded in all details. I just did it.

See http://en.wikipedia.org/wiki/Rich_Text_Format[^].

Why using such archaic legacy stuff? What''s wrong with HTML? PDF, to the worst end?

—SA


这篇关于Richtextbox .rtf函数中的UTF-8问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆