question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

react native 0.50.3 android webkit html Chinese garbled

See original GitHub issue

Is this a bug report?

YES

Have you read the Contributing Guidelines?

YES

Environment

Steps to Reproduce

(Write your steps here:) After I upgraded to version 0.50.3, there was no code for the webkit HTML in android, and none of the 0.49 version had this problem

<WebView
                            source={{html: `<!DOCTYPE html><html><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="chrome=1"><meta content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=0;" name="viewport"><style>img {max-width: 100%}</style></head><body><p>这里是测试中文</p><script>var count = 0;function updateHeight(){window.location.hash = count++;document.title = document.body.clientHeight;};window.onload=window.onresize=function(){updateHeight();setTimeout(updateHeight, 1000);}</script></body></html>`}}
                            style={{flex:1, height: this.state.height, minHeight: 500}}
                            bounces={false}
                            scrollEnabled={false}
                            scalesPageToFit={true}
                            automaticallyAdjustContentInsets={true}
                            onNavigationStateChange={this.onNavigationStateChange}
                        >
                        </WebView>

image

Expected Behavior

Normal display Chinese

Actual Behavior

Chinese scrambled

Reproducible Demo

(Paste the link to an example project and exact instructions to reproduce the issue.)

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:10 (1 by maintainers)

github_iconTop GitHub Comments

36reactions
Tennencommented, Nov 29, 2017

well, I found a solution for this problem. it seems to be an android bug of WebView.loadData method, adding baseUrl: '' to source props forces native side to use WebView.loadDataWithBaseUrl instead, which works well with other languages. maybe you guys can have a try @fuxianwei @efkan

0reactions
khanhtdbsecommented, Jan 15, 2018

@Tennen Save me hours 👍

Read more comments on GitHub >

github_iconTop Results From Across the Web

WebView - React Native
Loads static HTML or a URI (with optional headers) in the WebView. ... On Android, the only supported methods are GET and POST....
Read more >
react native - Expo-Vector-Icons show up on my Snack but are ...
Expo-Vector-Icons show up on my Snack but are showing as question mark or Chinese character in the Android built app · android ·...
Read more >
[fedora-arm] arm rawhide report: 20140712 changes
New package: gcin-2.8.2-2.fc21 An input method focused on Chinese users New package: gcolor2-0.4-8.fc21 A simple color selector for GTK+2 ...
Read more >
raspbian.grn.cat/raspbian/dists/stretch-staging/ma...
This package includes the html documentation for 389-ds-console. ... Description: Android Asset Packaging Tool The Android Asset Packaging Tool (aapt) takes ...
Read more >
</s> 56499297 the 69513454 , 55850777 . 51967804
8483 corrupt 8482 greenwich 8482 simplified 8481 defendant 8480 ... delicate 5273 provoked 5271 boyle 5271 commodity 5271 react 5270 emigration 5270 suppose ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found