user3904345
user3904345

Reputation:

Formatting unicode characters

I am getting string in following format-

\"When you\u2019re riding, only the race in which you\u2019re riding is important.\u201D

where \u2019 is for single quote

and \" and \u201D is for right and left double quote.

I want to format it such that it displays properly like-

"When you're riding, only the race in which you're riding is important."

How can i do that?

Upvotes: 0

Views: 108

Answers (1)

arodriguezdonaire
arodriguezdonaire

Reputation: 5563

Try this:

try
{
    String s = new String("\"When you\u2019re riding, only the race in which you\u2019re riding is important.\u201D".getBytes(), "UTF-8");
}
catch (UnsupportedEncodingException e)
{
    Log.e("utf8", "conversion", e);
}

Upvotes: 2

Related Questions