I need to paste an RTF non-ANSI string into a RichTextBox

D

**Developer**

I need to paste an RTF non-ANSI string into a RichTextBox.

I know how to do that if the string were all ANSI characters.

But the text contains Unicode characters that have no ANSI equivalent. I
don't know how to include them.

Can you help?



Thanks
 
N

Nicholas Paldino [.NET/C# MVP]

You can include them just fine. It just might be that the font doesn't
support them.

Why not use a font that supports those characters?

Or are you trying to strip these characters?
 
D

**Developer**

Private Sub DisplayCulture(ByVal Code As String)

Dim CI As CultureInfo = New CultureInfo(Code, False)

Dim MyRI1 As New RegionInfo(CI.LCID)

---snip

mStr = MyRI1.CurrencySymbol & ControlChars.Tab & "Currency symbol"



I do the above for say, Arabic, and then drawn mStr on a picturebox and copy
mStr to the clipboard.

The string mStr displays OK on the picture box but pasting from the
clipboard into a RichTextBox or into Word show ? where Arabic characters
were.

Got any idea what is going on?

I assumed the problem is converting these symbols to RTF which is all ANSI
is needed.



Thanks











Nicholas Paldino said:
You can include them just fine. It just might be that the font doesn't
support them.

Why not use a font that supports those characters?

Or are you trying to strip these characters?


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

**Developer** said:
I need to paste an RTF non-ANSI string into a RichTextBox.

I know how to do that if the string were all ANSI characters.

But the text contains Unicode characters that have no ANSI equivalent. I
don't know how to include them.

Can you help?



Thanks
 
N

Nicholas Paldino [.NET/C# MVP]

It looks like the font you are using in your rich text box doesn't
support the characters that you are trying to insert. You say you draw it
on a picturebox. Is the font you use to render the image on the picturebox
the same font that the characters are being written in on the rich text box?


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

**Developer** said:
Private Sub DisplayCulture(ByVal Code As String)

Dim CI As CultureInfo = New CultureInfo(Code, False)

Dim MyRI1 As New RegionInfo(CI.LCID)

---snip

mStr = MyRI1.CurrencySymbol & ControlChars.Tab & "Currency symbol"



I do the above for say, Arabic, and then drawn mStr on a picturebox and
copy mStr to the clipboard.

The string mStr displays OK on the picture box but pasting from the
clipboard into a RichTextBox or into Word show ? where Arabic characters
were.

Got any idea what is going on?

I assumed the problem is converting these symbols to RTF which is all ANSI
is needed.



Thanks











Nicholas Paldino said:
You can include them just fine. It just might be that the font
doesn't support them.

Why not use a font that supports those characters?

Or are you trying to strip these characters?


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

**Developer** said:
I need to paste an RTF non-ANSI string into a RichTextBox.

I know how to do that if the string were all ANSI characters.

But the text contains Unicode characters that have no ANSI equivalent. I
don't know how to include them.

Can you help?



Thanks
 

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