0

I have released a windows phone app a while back. Since then, BugSense reported a problem that is causing some crashes in foreign countries:

System.ArgumentException - The character 'İ' (0x0130) is not available in this SpriteFont. If applicable, adjust the font's start and end CharacterRegions to include this character. Parameter name: character

and here is the stack trace:

at Microsoft.Xna.Framework.Graphics.SpriteFont.GetIndexForCharacter(Char character) at Microsoft.Xna.Framework.Graphics.SpriteFont.InternalMeasure(StringProxy& text) at Microsoft.Xna.Framework.Graphics.SpriteFont.MeasureString(String text) at GlobalEngine.Visual.TextBase.CalculateSpriteOrigin(Object sender, EventArgs e) at System.EventHandler.Invoke(Object sender, EventArgs e) at GlobalEngine.Visual.TextBase.set_FormattedText(String value) at GlobalEngine.Visual.TextLabel.set_Text(String value) at FourWordsLibrary.GameUtils.Letter..ctor(Char letter, AssetManager assetManager, SpriteBatch spriteBatch, Single width) at FourWordsLibrary.GameUtils.Word..ctor(String orderedWord, String shuffledWord, AssetManager assetManager, SpriteBatch spriteBatch, InputManager inputManager, Single letterWidth) at FourWordsLibrary.GameUtils.Word..ctor(String orderedWord, String shuffledWord, AssetManager assetManager, SpriteBatch spriteBatch, InputManager inputManager) at FourWordsLibrary.Controllers.GameControl.StatePlay.SetupNextLevel() at FourWordsLibrary.Controllers.GameControl.StatePlay.Activate(Object obj) at GlobalEngine.Base.StateManager1.SetState(T state, Object obj) at GlobalEngine.Base.StateManager1.SetState(T state) at FourWordsLibrary.Controllers.GameControl.SetPack(PackManager packManager) at FourWords.Screens.GameScreen..ctor(Engine engine, Object obj)

My app is a word game, and I retrieve the words for each level from an XML file. So I suspect that as the XmlReader is reading the file, it does so using a foreign culture which results in with a Latin letter being retrieved, then the app crashes when it tries to draw the letter using a strictly English sprite-font. I tried looking for a way to instruct the XmlReader to read using InvariantCulture, similar to that found in the .toString() method, but haven't found any. Any ideas how to solve this issue?

user123
  • 632
  • 1
  • 6
  • 22

1 Answers1

0

Seems more an input XML file problem to me. Check if it contains this 'invalid' character ('İ' (0x0130) ) and correct it if necessary. If you wrote the input XML using your app/game, check if you are writing the contents using InvariantCulture as well.

Br,

vidonism
  • 119
  • 1
  • 5
  • I found no such character in my XML document. I create and populate my XML file using a basic editor I created in WPF, where I type the words into basic text boxes. The words are then written into the XML using the StreamWriter object, which doesn't seem to take any arguments relating to culture. – user123 Aug 01 '13 at 11:03
  • Check your editor where you are writing the words from text boxes, you can call .ToString().ToUpperInvariant() for example (if you are using only uppercase letters). Otherwise call .ToString(System.Globalization.CultureInfo.InvariantCulture) Would also help if you can post a small XML sample – vidonism Aug 01 '13 at 11:27