How to: Use Special Characters in XAML

Markup files that are created in Microsoft Visual Studio are automatically saved in the Unicode UTF-8 file format, which means that most special characters, such as accent marks, are encoded correctly. However, there is a set of commonly-used special characters that are handled differently. These special characters follow the World Wide Web Consortium (W3C) XML standard for encoding.

The following table shows the syntax for encoding this set of special characters:

Character

Syntax

Description

<

&lt;

Less than symbol.

>

&gt;

Greater than sign.

&

&amp;

Ampersand symbol.

"

&quot;

Double quote symbol.

Note Note

If you create a markup file using a text editor, such as Windows Notepad, you must save the file in the Unicode UTF-8 file format in order to preserve any encoded special characters.

The following example shows how you can use special characters in text when creating markup.

<!-- Display special characters that require special encoding: < > & " -->
<TextBlock>
  &lt;    <!-- Less than symbol -->
  &gt;    <!-- Greater than symbol -->
  &amp;   <!-- Ampersand symbol -->
  &quot;  <!-- Double quote symbol -->
</TextBlock>

<!-- Display miscellaneous special characters -->
<TextBlock>
  Cæsar   <!-- AE dipthong symbol -->
  © 2006  <!-- Copyright symbol -->
  Español <!-- Tilde symbol -->
  ¥       <!-- Yen symbol -->
</TextBlock>
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft