Hyphen sometimes not appearing in RichTextBox  
Author Message
poita





PostPosted: Visual C++ Express Edition, Hyphen sometimes not appearing in RichTextBox Top

I'm reading in some strings from a text file and using them as the text field for a RichTextBox. However, after I do this, some of the hyphens (-) don't appear in the text box. For example "abc - def +/- ghi" is shown as "abc def +/- ghi" (first hyphen disappears but the second one stays).

I'm using managed C++ and the text is stored in a System::String.

Thanks in advance.






Visual Studio Express Editions34  
 
 
nobugz





PostPosted: Visual C++ Express Edition, Hyphen sometimes not appearing in RichTextBox Top

This code works just fine, show us some of yours:

System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) {
String^ s = "abc - def +/- ghi";
this->richTextBox1->Text = s;
}



 
 
poita





PostPosted: Visual C++ Express Edition, Hyphen sometimes not appearing in RichTextBox Top

Sorry, turns out that that string actually works. Try this one (the one I'm actually using):

"(a) Change of F number – table 5.5 (b) Ferrous metals any change in minimum tensile strength (c) Ferrous metals any change in composition except +/- .5% Mo"

The first hyphen (before "table") disappears but the one in the "+/-" stays. I just assumed it would be the same with "abc - def +/- ghi", which as it appears is not true since it works at this end just like you said.

[EDIT]

Also just realised that ° doesn't show up either in the string "Preheat (°C)".

 
 
nobugz





PostPosted: Visual C++ Express Edition, Hyphen sometimes not appearing in RichTextBox Top

That still doesn't reproduce, neither the hyphen nor the degree symbol. You may be battling a character encoding issue. The hyphen may be Unicode codepoint 0x00AD ("soft hyphen"), the degree symbol may be 0x00BA ("masculine ordinal indicator"). If you're reading this text from a file with StreamReader, play with its Encoding property...


 
 
poita





PostPosted: Visual C++ Express Edition, Hyphen sometimes not appearing in RichTextBox Top

Thanks, that did the trick, appears it was the encoding.

Sorry for my poor examples.