Search

Symbol changed in richtextbox by CSSForumEngineer

Closed
as By Design Help for as By Design

1
0
Sign in
to vote
Type: Bug
ID: 780766
Opened: 3/6/2013 1:27:15 AM
Access Restriction: Public
0
Workaround(s)
0
User(s) can reproduce this bug
This is happend when trying to read rtf string from database to richtextbox. If the string contains degree symbol with Bookman old style then it will changed. But, if the symbol is in century, it can be displayed properly.
Details (expand)

Visual Studio/Team Foundation Server/.NET Framework Tooling Version

Visual Studio 2012

Steps to reproduce

1.Create a WPF application with these code below:
.xaml file:
<StackPanel>
        <RichTextBox Name="RTB">        
        </RichTextBox>
        <Button Click="Button_Click"> Click</Button>
    </StackPanel>

.cs file
private void Button_Click_1(object sender, RoutedEventArgs e)
        {

            string s = @"{\rtf1\ansi\ansicpg1252\deff0\deflang1033\deflangfe1033{\fonttbl{\f0\froman\fprq2\fcharset0 Bookman Old Style;}} \viewkind4\uc1\pard\lang2057\f0\fs20 Red light of wavelength 6400 \~b0A in air has a wavelength of 4000 \~b0A in glass. If the wavelength of violet light in air is 4400 \~b0A` the wavelength of light in glass will be\par }";    
            SetRTFText(s);
        }
public void SetRTFText(string text)
        {
            MemoryStream stream = new MemoryStream(ASCIIEncoding.Default.GetBytes(text));
            this.RTB.Selection.Load(stream, DataFormats.Rtf);
        }

2. Run this application, you will see the symbol turns to "b0A".

Product Language

English

Operating System

Windows 8

Operating System Language

English

Actual results

Symbol changed

Expected results

Symbol can display properly
File Attachments
0 attachments
Sign in to post a comment.
Posted by Microsoft on 3/12/2013 at 2:37 PM
According to the RTF specification (http://www.biblioscape.com/rtf15_spec.htm), \~b0A means "non-breaking space (\~), followed by the characters b0A".

To get the character at unicode codepoint b0 (= 176 decimal), use \u176A    This means "the character at codepoint 176 (degree sign), or if that is unavailable the letter A".
Posted by Microsoft on 3/6/2013 at 2:33 AM
Thank you for submitting feedback on Visual Studio and .NET Framework. Your issue has been routed to the appropriate VS development team for investigation. We will contact you if we require any additional information.
Posted by Microsoft on 3/6/2013 at 1:50 AM
Thank you for your feedback, we are currently reviewing the issue you have submitted. If this issue is urgent, please contact support directly(http://support.microsoft.com)
Sign in to post a workaround.