Cancel escape characters

T

Tim Mulholland

I am trying to parse a string of RTF pulled from the RTF property of a
textbox, going through it character by character

<example>

string s = textBox1.Rtf;
for (int iii = 0; iii < s.Length; iii++)
{
char c = s[iii];
DoSomething(c);
}
however, the RTF code contains a ton of backslash characters, and this
is causing them to be escaped when i'm going through each character. for
example... the RTF code starts off as "{\\rtf..."} and when i go through
it, i get the characters '{', '\', 'r' and so on, so the \\ is escaped.
How can i turn this off?
I know for a literal, i could use the @ symbol, but that seems to have
no effect here.

Thanks in advance!

Tim
 
V

Vadim Chekan

Tim said:
I am trying to parse a string of RTF pulled from the RTF property of a
textbox, going through it character by character
example... the RTF code starts off as "{\\rtf..."} and when i go through
it, i get the characters '{', '\', 'r' and so on, so the \\ is escaped.
How can i turn this off?

The backslash char shows as "\\".
So you get what you have, nothing else.
What exactly are you trying to turn off? :)))

Vadim Chekan.
 
J

Jeffrey Tan[MSFT]

Hi Tim,

I think you may refer to Microsoft Office web component to find if this was
what you want.

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 
J

Jeffrey Tan[MSFT]

Hi Tim,

If you want to get the non-escaped rtf text, you can replace the '\' with
'\\'.
If you have other concern, please feel free to let me know.

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 
T

Tim Mulholland

I was getting errors caused by some code that checked for escaped characters
and replaced them with other things - turns out i was mistaken on the RTF
spec, and thought that it really had two backslashes, not just one, all over
the place.

My apologies at wasting your time
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top