I have a UIWebView in which I display a HTML file with foreign language content (in this case French), which was translated by Google.
The original English text is:
Clear - used to stop all timers and clear the amounts shown to the far right of the view.
The translation from Google is this:
Effacer - permet d'arrêter toutes les minuteries et effacer les montants indiqués à l'extrême droite de la vue.
This is what's displayed in the iPhone Simulator when French is the localized language:
This is the code I am using to load it:
// determine what the language for this locale is...
NSString *sysLangCode = [[NSLocale preferredLanguages] objectAtIndex:0];
// contatenate the language code to the filename
NSURL *indexURL = [[NSBundle mainBundle] URLForResource: [NSString stringWithFormat:@"instRST-%@", sysLangCode]
withExtension:@"html"];
// load it...
[webView loadRequest:[NSURLRequest requestWithURL:indexURL]];
I have looked in Google, SO and UIWebView to find any settings that would make this render correctly. The font being used is Verdana.
What do I have to do to get this to render correctly?
I found the answer: see http://webdesign.about.com/od/localization/l/blhtmlcodes-fr.htm
This is the meta tag you have to use for French and other one-character languages:
<meta http-equiv="content-type" content="text/html;charset=utf-8">
This works for all languages, including two-character languages, like Japanese and Chinese.