STT LCU
STT LCU

Reputation: 4330

How to display Latin-1 characters in Android app

I have to fetch text from an online database encoded in Latin-1 charset and every special Latin character (i.e. à, ò, ù, è...) was displayed with black squares with a "?" inside.

How can i display this correctly?

Luckily i found an answer after a couple of hours and i want to share it with you all. Read below for my solution

Upvotes: 4

Views: 1985

Answers (1)

STT LCU
STT LCU

Reputation: 4330

solution was really simple but i haven't thought about it, but it has the benefit of being really simple to understand and implement. In fact, here is the code:

mIn = new BufferedReader(new InputStreamReader(mSocket.getInputStream(),"ISO-8859-1"));

this way, all the incoming strings from the Latin-1 server will be decoded correctly and will be displayed perfectly on android TextViews

Upvotes: 3

Related Questions