# Text contains characters that cannot be resolved by this SpriteFont

I'm trying to draw currency symbols in an Arial Spritefont. According to this site, the font contains these symbols. I've included the Unicode character region for these symbols in the Content Processor SpriteFont file, like so:

<CharacterRegions>
<CharacterRegion>
<Start>&#32;</Start>
<End>&#126;</End>
</CharacterRegion>
<CharacterRegion>
<!-- Currency symbols -->
<Start>&#8352;</Start>
<End>&#8378;</End>
</CharacterRegion>
</CharacterRegions>


However, whenever I try to draw a € (Euro) symbol, I get this exception:

Text contains characters that cannot be resolved by this SpriteFont

Inspecting the SpriteFont in the IDE at that breakpoint shows the € symbol is in there. I'm at a loss at what could be wrong. Why is this exception thrown?

• Related (potential duplicate?) gamedev.stackexchange.com/questions/56058/…
– user1430
Apr 28 '14 at 17:42
• If you look at the asker's answer, the problem is unrelated. They simply forgot to switch to the correct font, I've already checked for this. Apr 28 '14 at 17:56
• Yeah; just checking, it's the only other 'character not supported' question I recall seeing here in a while.
– user1430
Apr 28 '14 at 18:07
• Have you tried some unicode values from other encoding schemes? The euro symbol is one that varies between between Microsoft and Other. en.wikipedia.org/wiki/Western_Latin_character_sets_(computing) Apr 28 '14 at 18:10

The best way to handle this is to take advantage of the characters collection SpriteFont.Characters and see if it contains the character. Any character that returns false will result in an error when rendered using the sprite font.

For example the below is what I use to filter out non usable characters from my textboxes.

if (!Font.Characters.Contains(character) && character != '\r' && character != '\n') { return; }


The problem wasn't in the € sign, but another char embedded in the string.

This char was added by the NSNumberformatter (I'm using Xamarin), which is A0 or 160. As my font only went from 32 through 126, and 8352 through 8378, this obviously wouldn't work.

As such, the following code solved the problem, and the string is properly drawn now.

using System.Text;

if (priceString.Contains((char)160)) { priceString = priceString.Replace(((char)160).ToString(), ""); }

The reason I thought the problem was in the € was because it would work for the \$ sign - in truth, the formatter didn't add the non-breaking space in that currency format.