简体   繁体   English

在webView android中显示为“?”的汉字

[英]Chinese characters displayed as “?” in webView android

I am using Coolreader as an epubviewer, and it is working fine till Android Kitkat, but when i installed the same in Lollipop, chinese characters are showing as '?' 我正在使用Coolreader作为epubviewer,并且在Android Kitkat之前都可以正常工作,但是当我在Lollipop中安装了它时,汉字显示为'?' . I went through the source code of the coolreader application and got this page 我浏览了coolreader应用程序的源代码并获得了此页面

http://code.openhub.net/file?fid=PF-WK55Lf-fKyZHTWpimrfAIH3A&cid=O-7qUkxrhmk&s=&fp=309197&projSelected=true#L0 http://code.openhub.net/file?fid=PF-WK55Lf-fKyZHTWpimrfAIH3A&cid=O-7qUkxrhmk&s=&fp=309197&projSelected=true#L0

in line 1403 to 1444' I found something related to fonts, they have hard coded 5 fonts and below they have set '"Droid Sans Fallback " as default fallback font. 1403 to 1444' I found something related to fonts, they have hard coded 5 fonts and below they have set '"Droid Sans Fallback "行中1403 to 1444' I found something related to fonts, they have hard coded 5 fonts and below they have set '"Droid Sans Fallback "为默认后备字体。 I inspected /system/fonts in my emulator working in 5.1 and found out even if there is "Droid Sans Fallback" and other fonts are there only these fonts are coming in the applications font selector 我在使用5.1的模拟器中检查了/ system / fonts,发现即使存在"Droid Sans Fallback"和其他字体,应用程序字体选择器中也只有这些字体才会出现

cosmic gothic SC

comming soon

cutive mono

Dancing script

Droid sans mono

motoyalmaru

nanumgothic

noto sans myanmar

noto sans myanmar UI

noto serif

 roboto

 Roboto condensed

And i checked the same in 4.4.4 emulator 我在4.4.4模拟器中检查了相同的内容

Droid Naskh Shift Alt

 Droid Sans Fallback

Droid sans mono

droid serif

Motoyalmaru

NamumGothic

Padauk book

Roboto

Roboto Condensed

Now see my observations, in 4.4.4, I tried all the fonts and in all the fonts the chinese characters are loading correctly 现在看一下我的观察结果,在4.4.4中,我尝试了所有字体,并且在所有字体中汉字均正确加载

In 5.1.0 I tried all the available fonts but chinese characters are not loading in any of it, always ? 在5.1.0中,我尝试了所有可用的字体,但始终不会在其中加载汉字?

Then i took a copy of Droid Sans Fallback from 4.4.4 and pasted it in system/fonts in 5.1 then the droid sans fallback font appeard in font list of Coolreader, before , even though it exixted in system/fonts of 5.1, it was not appearing in the fonts list of coolreader. 然后,我从4.4.4复制了Droid Sans Fallback并将其粘贴到5.1的系统/字体中,然后droid sans fallback字体出现在Coolreader的字体列表中,即使该字体在5.1的系统/字体中存在,它也是不会出现在coolreader的字体列表中。 Then i selected it and i could see chinese characters. 然后我选择了它,然后我看到了汉字。

My question is in 4.4.4 all the fonts are loading chinese, but in 5.1.0, even though there are more fonts in the list none are loading chinese, So it must be something else which is causing the problem. 我的问题是在4.4.4中所有字体都加载中文,但是在5.1.0中,即使列表中还有更多字体都没有加载中文,所以一定是其他原因导致了问题。

I tired another reader called fb reader and it is showing chinese the funny part is that it has got ont 3 fonts in its fontslist, Droid sans, droid serif and droid mono . 我累了另一个叫做fb reader的阅读器,它向中国展示了一个有趣的部分是它的字体列表中只有ont 3字体, Droid sans, droid serif and droid mono

I almost created an app using cool reader and the same thing is haunting me please help 我差点用酷炫的阅读器创建了一个应用,同样的事情困扰着我,请帮忙

Is Lollipop no compatible with chinese in epub reader 棒棒糖与epub Reader中的中文不兼容吗

just try adding custom fonts to /fonts folder in the sdcard of the mobile. 只需尝试将自定义字体添加到手机sdcard中的/fonts文件夹中即可。 Because, coolreader library will detect fonts from /fonts folder in the sdcard also, I read about it in a page. 因为coolreader库还将检测sdcard中/fonts文件夹中的/fonts ,所以我在页面中对此进行了了解。 Also in your custom app just add the same font from kitkat (Droid Sans Fallback) in the assets folder of your source code, and use codes to copy paste the font(in the assets folder) to the the above mentioned /fonts folder in sdcard. 同样在您的自定义应用程序中,只需从kitkat (Droid Sans Fallback)的源字体的资产文件夹中添加相同的字体,然后使用代码将字体(在资源文件夹中)复制粘贴到sdcard中的上述/fonts文件夹中。

you can find code in stackoverflow itself to copy and paste files from assets folder to sdcard 您可以在stackoverflow本身中找到代码以将文件从资产文件夹复制并粘贴到sdcard

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM