Partager via


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.

NoteNote:

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.

Example

<!-- 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>