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:
- Create a file named .rtf
- Open .rtf
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.
精彩评论