开发者

Special charcters in Android using PhoneGap

开发者 https://www.devze.com 2023-02-07 04:31 出处:网络
Im using PhoneGap to develop an android application. The problem is characters like ã â 开发者_JS百科á ç are shown like ? (question mark)

Im using PhoneGap to develop an android application. The problem is characters like ã â 开发者_JS百科á ç are shown like ? (question mark) Has someone an idea to solve the problem? Thanks


You need to use the UTF-8 character set on your page. You can tell the browser to do so by adding this:

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 

... to the <head> section of your page.


In my Phonegap & jQueryMobile app, deployed on Android 4.0.3 device, I got a nastly little bit of this stuff showing up in my checkboxes:

â€,

That was the little critter in my case. I did not get any success with

<meta name="viewport" content="width=device-width, initial-scale=1, charset=utf-8">

But what did work was setting the charset as a direct attribute of the meta tag:

<meta charset="utf-8" name="viewport" content="width=device-width, initial-scale=1">

So it's worth your while experimenting exactly how to specify the charset.


Do you use Eclipse? If so, I believe here is what you are looking for:

UTF-8 unreadable in phonegap android

(Project - Properties - Resource: Text File Encoding - Other [UTF-8]).

0

精彩评论

暂无评论...
验证码 换一张
取 消