I'm stacked by converting string, here is my code:
fun getCurrentTitle() {
doAsync {
val str = URL("http://10.0.0.8:4800/${Utils.TITL}").readText(Charset.forName("UTF-8"))
uiThread {
current_song_title.text = str
System.out.println(str)
}
}
}
here is string that i get returned (in TextView is same)
I/System.out: Ti�sto - On My Way
and in Web-Browser returns correct string
Tiėsto - On My Way
I dont have idea what i do wrong...
Thanks in advance!
Edit If someone have same issue, here is solution. Thans to Vivick
val url = URL("http://10.0.0.8:4800/${Utils.TITL}").readText(Charset.forName("ISO-8859-1"))
As concluded in the comments, just utilize the ISO-8859-1 charset in order to see the characters you want.
(This is just a reiteration in order to get this post marked as solved)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With