Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Provided that all the characters that you're catering for exist in the <a href="http://en.wikipedia.org/wiki/Basic_Multilingual_Plane" rel="noreferrer">Basic Multilingual Plane</a> (it's unlikely that you'll need anything more), then a simple UTF-16 encoding should suffice.</p> <p>Wikipedia:</p> <blockquote> <p>All possible code points from U+0000 through U+10FFFF, except for the surrogate code points U+D800–U+DFFF (which are not characters), are uniquely mapped by UTF-16 regardless of the code point's current or future character assignment or use.</p> </blockquote> <p>The following sample program illustrates doing something along the lines of what you want:</p> <pre><code>static void Main(string[] args) { // ë char[] ca = Encoding.Unicode.GetChars(new byte[] { 0xeb, 0x00 }); var sw = new StreamWriter(@"c:/helloworld.rtf"); sw.WriteLine(@"{\rtf {\fonttbl {\f0 Times New Roman;}} \f0\fs60 H" + GetRtfUnicodeEscapedString(new String(ca)) + @"llo, World! }"); sw.Close(); } static string GetRtfUnicodeEscapedString(string s) { var sb = new StringBuilder(); foreach (var c in s) { if (c &lt;= 0x7f) sb.Append(c); else sb.Append("\\u" + Convert.ToUInt32(c) + "?"); } return sb.ToString(); } </code></pre> <p>The important bit is the <code>Convert.ToUInt32(c)</code> which essentially returns the code point value for the character in question. The RTF escape for unicode requires a decimal unicode value. The <code>System.Text.Encoding.Unicode</code> encoding corresponds to UTF-16 as per the MSDN documentation.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload