views:

38

answers:

1

In order to generate RTF programmatically I have decided to use rtflib v1.0 from codeproject.com. But I can't understand how to generate text in russian unicode. So I need to generate a unicode text. Could someone help me?

P.S. Honeslty, I could write in .rtf file some text in, only by opening it with MS Word. But after writeing some text in unicode, WordPad showed text is correctly.

A: 

Here are steps:

  1. Create a file named .rtf
  2. Open .rtf
  3. Write there the following code in order to generate an RTF file which contains UTF-8 encoded content:

    {\rtf1\adeflang1025\ansi

    {\fonttbl {\f26\fbidi \froman\fcharset204\fprq2{*\panose 010a0502050306030303}Sylfaen;} }

    {\rtlch\fcs1 \af31507 \ltrch\fcs0 \f26 \u\'3f\u\'3f\u\'3 A lot of other text and symbols

    like this: + - * _ }

    }

For example:

{\rtf1\adeflang1025\ansi

{\fonttbl
{\f26\fbidi \froman\fcharset204\fprq2{\*\panose 010a0502050306030303}Sylfaen;}
}

{\rtlch\fcs1 \af31507 \ltrch\fcs0 \f26 \u1329\'3f\u1330\'3f\u1331\'3f\u1332\'3f - these are first 4 latters of Armenian alphabet}

}

Foe more details see the UTF-8 encoding table here. And RTF spec is here.

Narek