Dorf
Dorf

Reputation: 71

RichTextBox Globalization

I am making a webservice that will need to create/manipulate rich text used by the client in a Windows/DotNet RichTextBox. The users of the service will be from all around the world.

The service accepts a string supplied by the client from RichTextBox.Rtf, does some manipulation and returns a string to the client which is put back into the Rtf field of the textbox.

Works fine but I have some concerns about globalization, for instance..

An empty RichTextBox on my dev machine has the Rtf as:

{\rtf1\ansi\ansicpg1252\deff0\deflang1044{\fonttbl{\f0\fnil\fcharset0 Microsoft Sans Serif;}}
\viewkind4\uc1\pard\f0\fs17\par
}

When a new record is created, the service needs to provide some default formatted text. I am assuming that someone that has a different language on their OS install will have different font, ansicodepage and deflang for the default empty RichTextBox. So I found I can supply the following string for a new record without getting a format exception...

{\rtf1\ansi\viewkind4\uc1\pard\f0\fs17 MyTextGoesHere\par}

After setting RichTextBox.Rtf to the above, I then inspect the Rtf and find it has reinserted the font and deflang as below...

{\rtf1\ansi\deff0{\fonttbl{\f0\fnil\fcharset0 Microsoft Sans Serif;}}\viewkind4\uc1\pard\lang1044\f0\fs17 MyTextGoesHere\par}

Questions:

1> Should I worry about this or must I keep stripping it out at my service?

2> Is it safe to strip it out? Will the clients still be able to use charachters from their language in the text?

3> Will it be cross language compatible? If I view the richtext using an OS/Language different than another user, will it look normal?

Any recomendations or pointers?

Upvotes: 0

Views: 168

Answers (1)

Dorf
Dorf

Reputation: 71

I think I am going to ask the user for his desired Rtf (supplied by his local OS RichTextBox) to use as when creating the new record. Then just assume it is empty and tack on my stuff at the end.

Upvotes: 0

Related Questions