代码之家  ›  专栏  ›  技术社区  ›  Dan Andreatta

system.windows.forms.richtextbox对unicode字符使用什么编码?

  •  1
  • Dan Andreatta  · 技术社区  · 15 年前

    我的应用程序中有一个WinForms RichTextBox。当我输入中文文本“______”时,控件使用以下RTF:

    \rtf1 \ansi \ansicpg1252 \deff0 \deflang1033 \fonttbl \f0 \fmodern \fprq6 \fcharset134 simsun;\f1 \fnil \fcharset0 microsoft sans-serif; \视图kind4 \uc1 \pard \f0 \fs17 \'c3 \'db \'c3 \'db \'c3 \'db \'c3 \'db \f1 \par }

    测试字符串是同一个字符四次。它的unicode值是34588(0x871c)。那么,如何将字符存储为RTF中的“c3”db?那是什么样的编码?

    1 回复  |  直到 15 年前
        1
  •  1
  •   Hans Passant    15 年前

    RTF是旧的,比作业老,比Unicode早得多。我想用 code page 936 ,用于简体中文的双字节字符集。您的代码段使用c3db为字符显示它,它与中显示的glyph匹配。 this table .