简体   繁体   中英

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 '?' . I went through the source code of the coolreader application and got this page

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. 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

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

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

In 5.1.0 I tried all the available fonts but chinese characters are not loading in any of it, always ?

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. 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.

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 .

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

just try adding custom fonts to /fonts folder in the sdcard of the mobile. Because, coolreader library will detect fonts from /fonts folder in the sdcard also, I read about it in a page. 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.

you can find code in stackoverflow itself to copy and paste files from assets folder to sdcard

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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