- Home /
Problem with StringReader or TextAsset not reading some characters
My code:
StringReader tr = null;
TextAsset data = (TextAsset)Resources.Load("data.ext", typeof(TextAsset));
tr = new StringReader(data.text);
sTemp = tr.ReadLine();
Debug.Log(sTemp);
data.ext file:
00!%%%£r!%%%£122222230e0e01255
My output:
00!%%%r!%%%122222230e0e01255
As you can see StringReader (or possibly TextAsset) doesn't seem to like the £ character.
I have looked on the .net and unity docs, but I can't find any explanation.
Thanks for your help.
Comment
Best Answer
Answer by danny83 · Nov 13, 2011 at 02:58 PM
Found the solution. I saved my text file with UTF8 encoding and now everything is fine. No changes to the code were needed.
Your answer
![](https://koobas.hobune.stream/wayback/20220613035515im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Using Resources.Load from a non script component class 2 Answers
Converting strings to numbers 1 Answer
String.Equals returning false? 2 Answers
How can i split a string[] ? 1 Answer
Using Microsoft surface 2.0 with Unity 3 Answers