J W
J W

Reputation: 878

UIWebView, quote characters with Arial font not showing up correctly

I have some .html with the font defined as:

<font color="white" face="Arial">

I have no other style applied to my

tag. In it, when I display data like:

<b> “Software” </b>

or

<b>“Software”</b>

they both display characters I do not want in the UIWebView. It looks like this on a black background:

enter image description here

How do I avoid that? If I don't use font face="arial", it works fine.

Upvotes: 0

Views: 617

Answers (2)

mvds
mvds

Reputation: 47094

This is an encoding issue. Make sure you use the same encoding everywhere. UTF8 is probably the best choice.

You can put a line

<meta http-equiv="content-type" content="text/html;charset=UTF-8" />

in your html to tell UIWebView about the encoding.

To be precise, “ is what you get when you take the UTF-8 encoding of , and interpret it as ISO-8859-1. So your data is encoded in UTF-8, which is good, and you just need to set the content type to UTF-8 instead of ISO-8859-1 (e.g. using the <meta> tag above)

Upvotes: 1

Noah Witherspoon
Noah Witherspoon

Reputation: 57139

You shouldn’t generally use the curly quote characters themselves—character encodings will always mess you up somehow. No idea why it works correctly when you don’t use Arial (though that suggests a great idea: don’t use Arial), but your best bet is to use the HTML entities &ldquo; and &rdquo; instead.

Upvotes: 0

Related Questions