Main Page | Report this Page
Computers Forum Index  »  Computer - Fonts  »  rtf question...
Page 1 of 1    

rtf question...

Author Message
Andreas Prilop...
Posted: Mon Sep 07, 2009 8:14 pm
Guest
On Sat, 5 Sep 2009, John wrote:

Quote:
I am writing a program that takes an rtf generated by another
program and replaces certain keys in it with other rtf. In many
cases the replacing rtf has special characters and does not
display properly with the headers in the original rtf. For
example:
\mac
\ansicpg10000
\fcharset77

These three specify the same thing, namely the MacRoman character set
(or rather encoding) - but for different versions of MS Word.

Quote:
the following rtf file with simpler headers does display the characters
properly:
\ansi

This means cp1252.

Carefully read the RTF specification.
http://www.google.co.uk/search?q=RTF+specification

I suggest you encode all your special, non-ASCII characters by Unicode:
\u945
is "small alpha" 945 = x3B1.

--
Solipsists of the world - unite!
 
John...
Posted: Tue Sep 08, 2009 5:16 am
Guest
Andreas Prilop wrote:
Quote:
On Sat, 5 Sep 2009, John wrote:

I am writing a program that takes an rtf generated by another
program and replaces certain keys in it with other rtf. In many
cases the replacing rtf has special characters and does not
display properly with the headers in the original rtf. For
example:
\mac
\ansicpg10000
\fcharset77

These three specify the same thing, namely the MacRoman character set
(or rather encoding) - but for different versions of MS Word.

the following rtf file with simpler headers does display the characters
properly:
\ansi

This means cp1252.

Carefully read the RTF specification.
http://www.google.co.uk/search?q=RTF+specification

I suggest you encode all your special, non-ASCII characters by Unicode:
\u945
is "small alpha" 945 = x3B1.


Thank you! I have converted all the special characters to unicode.
Checked it all with TextEdit (this is on a Mac) and it looked okay.
But now I have a new problem with it.

{\rtf1\ansi
{\fonttbl\f0\fswiss Times;}
{\colortbl;\red255\green255\blue255;}
\ql
{\u201}tat De La Force \line
\par \page
\par }

displays fine with TextEdit but it crashes both
NeoOffice and OpenOffice:

Read error: file format error found at 8,1 (row,col)

Apparently it doesn't like the {\u201} somehow.

TextEdit does not understand enough formatting rtf to be useful for
my project, NeoOffice or OpenOffice must work. It does when the
above unicode is coded as: {\'c9} . I don't have Word or any M$
products on this machine.

When I code it in line simply as \u201tat , TextEdit eats the
character after the special character, even if I put a blank
after the unicode (as \u201 tat). And NeoOffice doesn't crash,
but it too eats the next character, whether the unicode is followed
by a blank or not.

Now I don't know what to do. Any suggestions?

By using the {\'c9} construct, I can get it to print properly
in TextEdit, NeoOffice, and OpenOffice, as long as I choose
the font headers carefully. I guess I'll have to go back to
that unless someone has some fix for this.

Thanks!
 
Andreas Prilop...
Posted: Tue Sep 08, 2009 7:00 pm
Guest
On Mon, 7 Sep 2009, John wrote:

Quote:
{\u201}tat
Apparently it doesn't like the {\u201} somehow.

No curly brackets around \u201 .

Quote:
When I code it in line simply as \u201tat , TextEdit eats the
character after the special character, even if I put a blank
after the unicode (as \u201 tat).

The next character is the replacement character for programs
that don't understand Unicode. You could write \u201Etat ,
or simply \u201_tat if you are lazy and know that all your
programs understand \u .

Once again: Read the RTF specification(s).
http://www.google.co.uk/search?q=RTF+specification

--
Solipsists of the world - unite!
 
John...
Posted: Tue Sep 08, 2009 8:48 pm
Guest
Andreas Prilop wrote:
Quote:
On Mon, 7 Sep 2009, John wrote:

{\u201}tat
Apparently it doesn't like the {\u201} somehow.

No curly brackets around \u201 .

When I code it in line simply as \u201tat , TextEdit eats the
character after the special character, even if I put a blank
after the unicode (as \u201 tat).

The next character is the replacement character for programs
that don't understand Unicode. You could write \u201Etat ,
or simply \u201_tat if you are lazy and know that all your
programs understand \u .

Once again: Read the RTF specification(s).
http://www.google.co.uk/search?q=RTF+specification


I missed a tree while looking at the forest. I didn't realize
that the next character was required and is what is printed if
unicode isn't understood. A good idea really.

It works in TextEdit, NeoOffice, and OpenOffice if I use
{\u201E}tat or \u201Etat . Indeed it now makes sense that
the curly brackets appeared unbalanced in Neo/OpenOffice
because it "ate" the rightmost one, unbalancing them. Somehow,
TextEdit recovers.

Thank you again!
 
Zedex Dragon...
Posted: Wed Sep 09, 2009 10:33 am
Guest
I was under the impression that RTF did not support unicode.
 
Andreas Prilop...
Posted: Wed Sep 09, 2009 7:32 pm
Guest
On Wed, 9 Sep 2009, Zedex Dragon wrote:

Quote:
I was under the impression that RTF did not support unicode.

Since version 1.5 - i.e. since MS Word 97.

--
I used to believe in reincarnation in a former life.
 
John...
Posted: Thu Sep 10, 2009 2:00 am
Guest
Zedex Dragon wrote:
Quote:
I was under the impression that RTF did not support unicode.

See: http://www.biblioscape.com/rtf15_spec.htm
 
 
Page 1 of 1    
All times are GMT
The time now is Thu Dec 03, 2009 4:11 pm