我有一个UIWebView,我在其中显示一个包含外语内容的HTML文件(在本例中为法语),由Google翻译.
原文英文是:
清除 - 用于停止所有计时器并清除显示在视图最右侧的数量.
谷歌的翻译是这样的:
Effacer - permetd'arrêter的旅游景点和旅游景点,其中包括de la vue.
当法语是本地化语言时,这就是iPhone模拟器中显示的内容:

这是我用来加载它的代码:
// 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]];
Run Code Online (Sandbox Code Playgroud)
我查看过谷歌,SO和UIWebView,找到任何可以正确渲染的设置.使用的字体是Verdana.
我该怎么做才能正确渲染?
Spo*_*ude 13
我找到了答案:见http://webdesign.about.com/od/localization/l/blhtmlcodes-fr.htm
这是您必须用于法语和其他单字符语言的元标记:
<meta http-equiv="content-type" content="text/html;charset=utf-8">
Run Code Online (Sandbox Code Playgroud)
这适用于所有语言,包括日语和中文等双字符语言.
| 归档时间: |
|
| 查看次数: |
3915 次 |
| 最近记录: |