R – Displaying ® symbol in Silverlight

encodingsilverlightunicodexamlxml

Folks!

I am trying to display ® and superscript TM symbols in my silverlight app. I want to save the text containing the symbols in a resx file.

Things i have tried:

  • Copy paste the ® symbol from any document to resx file. ® symbol gets
    displayed in the resx file. But, when
    running the silverlight app,
    xamlparseexception is thrown.

  • Use unicode text &#174 instead of ® symbol in the resx file. Same
    xamlparseexception thrown.

My resx file encoding is utf-8.

Appreciate your thoughts!

EDITED:
Incorrectly mentioned @ instead of ®.

Redbox in the snapshot is how the symbol gets displayed in Silverlight. Bluebox is how it needs to be displayed.
alt text

EDIT 2 and SOLUTION:
The way the symbols are displayed are dependant on the font used. Also, displaying superscripts in Silverlight is a bit tricky. But, the simplest solution i found was to create the superscript text in Windows character map tool and copy paste it your app resource file.

Best Answer

The size of the ® symbol varies with the font being used. Some fonts draw it as a superscript others draw it as a standard character. For example the "Lucida Sans Unicode" font treats it like a Superscript where as the "Lucida Grande" font draws it like a normal character. Hence you need to be careful which font you use to render it.

I'm seeing a case in point just as I write this. The text box where I'm writing this in SO has the ® character as a superscript whereas looking at the preview box below the character is normal size.

Related Topic