开发者

How to write programmatically some unicode text in RTF format?

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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜