Problem with special char android!! How can i fix my problem?
Hello everybody! i'm making a vr app for Gear VR. Android is the platform i used. My app recall the images and the texts from external folders. the problem is with special char(see the image below). The function that read the .txt file is :
public static string Leggifile(string fileName)
{
string output = "";
try{
string line;
StreamReader thReader = new StreamReader(fileName,Encoding.Default);
using (thReader){
do{
line = thReader.ReadLine();
if (line!=null){
output += line;
}
}
while(line !=null);
thReader.Close();
return output;
}
} catch (Exception e)
{
Debug.LogWarning ("non trovo il file: " + fileName + " " + e.Message);
output += e.Message;
}
return output;
}
I think that the problem is in Encoding.default but i don't know how to fix. I also change the parameter in the font:
Answer by Ran-Quan · Mar 22, 2017 at 05:33 AM
Try changing to another font, if the problem still exists, then probably your .txt file's encoding does not match with OS's default setting. Then you can try setting the encoding explicitly like Encoding.UTF8
or Encoding.GetEncoding("ISO-8859-1")
Your answer
Follow this Question
Related Questions
android native library: Content is not allowed in prolog 0 Answers
how to create moving foward character with button ? 0 Answers
How to find the left alignement offset of the left characters of a TextMesh ? 0 Answers
Unity3d files convert to base64 encode 0 Answers
Custom font unicode vertical alignment wrong not fixed? 2 Answers