Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 79144

Characters not recognized when reading from embedded txt

$
0
0

Hi everyone.
I want to include a very long text (a book) on my app, and for that I am using a .txt as an embedded resource. I am using this code to do it:

var assembly = IntrospectionExtensions.GetTypeInfo(typeof(Contenido)).Assembly;
Stream stream = assembly.GetManifestResourceStream("RetornoApp.Retorno.txt");

string contenido = "";
using (var reader = new StreamReader(stream))
{
contenido = reader.ReadToEnd();
}

Label label = new Label() { Text = contenido};

It's working almost fine. The problem is that the characters such as áéíóú are not being written correctly, and a � is being displayed instead. It is a book in spanish so it's not a small problem since these characters are frequent.
I am guessing it's beacuse I am using a stream?

Thanks!!!


Viewing all articles
Browse latest Browse all 79144

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>