0

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 writing some text in unicode, WordPad showed text is correctly.

tshepang
  • 12,111
  • 21
  • 91
  • 136
Narek
  • 38,779
  • 79
  • 233
  • 389

1 Answers1

1

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<unicode number>\'3f\u<unicode number>\'3f\u<unicode number>\'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.

Michael Celey
  • 12,645
  • 6
  • 57
  • 62
Narek
  • 38,779
  • 79
  • 233
  • 389