Bohn
Bohn

Reputation: 26919

How can I know what part of RTF syntax is wrong

an RTF is getting built and passed into some methods and finally getting passed to a text editor but something is wrong because the editor cannot parse it and instead of the correct text - NewYork in this case- it will show the whole rtf text but I have problem with finding out what is actually wrong with this RTF so maybe I can narrow it down and find out where is the place in code that is messing up the rtf tags, in my example it looks like this:

"{\rt\plain\f0\fs24 f1\ansi\deff0{\fonttbl{\f0\fswiss Microsoft Sans Serif;}{\f1\fswiss Tahoma;}}\deflang2057\deflange2057 \plain \f0 \fs24 \cb2 NewYork \plain \f0 \fs24 \cb2}"

Upvotes: 3

Views: 5084

Answers (2)

dee-see
dee-see

Reputation: 24078

Should start with \rtf1 and you had a stray f1 that should have been \f1.

{\rtf1\plain\f0\fs24 \f1\ansi\deff0{\fonttbl{\f0\fswiss Microsoft Sans Serif;}{\f1\fswiss Tahoma;}}\deflang2057\deflange2057 \plain \f0 \fs24 \cb2 NewYork \plain \f0 \fs24 \cb2}"

Upvotes: 4

Zelter Ady
Zelter Ady

Reputation: 6348

Because your RTF is short you may eliminate parts of it until you identify the error place.

The way I build/correct RTF code is by editing in Word (or WordPad) and see what code it generates.

Upvotes: 2

Related Questions