Tencent / VasSonic

VasSonic is a lightweight and high-performance Hybrid framework developed by tencent VAS team, which is intended to speed up the first screen of websites working on Android and iOS platform.
Other
11.8k stars 1.61k forks source link

使用Sonic3.1.0加载纯文字的网页文字乱码 #293

Closed HuaZaiWuDi closed 5 years ago

HuaZaiWuDi commented 5 years ago

What steps will reproduce the problem? 该问题的重现步骤是什么?

  1. 使用Sonic加载纯文字的html,非本地
  2. 清除应用首次加载正常,退出使用缓存出现异常,
  3. 加载普通网页如www.baidu.com,正常。使用本地纯文字html,正常 4.网站通过浏览器打开正常

What is the expected output? What do you see instead? 你期待的结果是什么?实际看到的又是什么? _20190219112151 _20190219112143

What version of the product are you using? On what operating system? 你正在使用产品的哪个版本?在什么操作系统上? Android 使用3.1,0版本

Please provide any additional information below. 如果有的话,请在下面提供更多信息。 LOG: D/CrashReport: >>> com.wesmartclothing.tbra.ui.login.RegisterActivity onPaused <<< D/HwCust: Create obj success use class android.app.HwCustActivityImpl D/HwCust: Create obj success use class android.app.HwCustHwWallpaperManagerImpl V/ActivityThread: ActivityThread,callActivityOnCreate D/CrashReport: >>> com.wesmartclothing.tbra.base.BaseTitleWebActivity onCreated <<< D/HwRTBlurUtils: check blur style for HwPhoneWindow, themeResId : 0x7f10000e, context : com.wesmartclothing.tbra.base.BaseTitleWebActivity@e812112, Nhwext : 0, get Blur : disable with , null D/HwRTBlurUtils: check blur style for HwPhoneWindow, themeResId : 0x7f10000e, context : com.wesmartclothing.tbra.base.BaseTitleWebActivity@e812112, Nhwext : 0, get Blur : disable with , null D/TAG: title:注册协议 D/TAG: url:http://doc.wesmartclothing.com/terms/wemeet.html I/TAG: 【BaseAcFragment】:onAttach I/TAG: 【BaseAcFragment】:onCreate I/WebViewFactory: Loading com.google.android.webview version 71.0.3578.99 (code 357809950) D/HwFLClassLoader: USE_FEATURE_LIST had not init! I/cr_LibraryLoader: Time to load native libraries: 1 ms (timestamps 7364-7365) I/chromium: [INFO:library_loader_hooks.cc(36)] Chromium logging enabled: level = 0, default verbosity = 0 I/cr_LibraryLoader: Expected native library version number "71.0.3578.99", actual native library version number "71.0.3578.99" I/SonicSdk_SonicSession: session(113017) create:id=tbra_ed3dbfc8918ff3f0067aa75966efdc44, url = http://doc.wesmartclothing.com/terms/wemeet.html. I/SonicSdk_SonicSession: session(113017) now post sonic flow task. D/SonicSdk_SonicEngine: onSessionStateChange:session(113017) from state 0 -> 1 I/SonicSdk_SonicSession: session(113017) bind client. I/SonicSdk_DefaultSonicCacheInterceptor: session(113017) runSonicFlow : session data is empty. I/SonicSdk_DefaultSonicCacheInterceptor: session(113017) runSonicFlow:verify error so remove session cache, cost 7ms. I/SonicSdk_SonicSession: session(113017) runSonicFlow verify cache cost 8 ms I/SonicSdk_QuickSonicSession: session(113017) runSonicFlow has no cache, do first load flow. I/SonicSdk_SonicSession: Session (tbra_ed3dbfc8918ff3f0067aa75966efdc44) send sonic request, etag=(null), templateTag=(null) E/SonicSdk_SonicSessionConnection: create UrlConnection cookie is empty W/cr_ChildProcLH: Create a new ChildConnectionAllocator with package name = com.google.android.webview, sandboxed = true I/cr_BrowserStartup: Initializing chromium process, singleProcess=false I/zygote64: Compiler allocated 5MB to compile void android.view.View.(android.content.Context, android.util.AttributeSet, int, int) W/rtclothing.tbra: type=1400 audit(0.0:39894): avc: denied { read } for name="vmstat" dev="proc" ino=4026532217 scontext=u:r:untrusted_app:s0:c512,c768 tcontext=u:object_r:proc:s0 tclass=file permissive=0 I/SonicSdk_QuickSonicSession: session(113017) onClientReady: have pending client core message ? -> false. I/TAG: 【BaseAcFragment】:onActivityCreated I/TAG: 【BaseAcFragment】:onStart D/ActivityThread: add activity client record, r= ActivityRecord{5ff2ef token=android.os.BinderProxy@b7e1b74 {com.wesmartclothing.tbra/com.wesmartclothing.tbra.base.BaseTitleWebActivity}} token= android.os.BinderProxy@b7e1b74 D/CrashReport: >>> com.wesmartclothing.tbra.base.BaseTitleWebActivity onResumed <<< I/TAG: 【BaseAcFragment】:onResume D/OpenGLRenderer: HWUI Binary is enabled D/SonicSdk_SonicSession: session(113017) handleMessage: msg what = 5. I/SonicSdk_QuickSonicSession: session(113017) handleClientCoreMessage_PreLoad:PRE_LOAD_NO_CACHE load url. I/PressGestureDetector: onAttached begin I/PressGestureDetector: onAttached end I/PressGestureDetector: enabledInPad = false,isPcCastMode = false D/SonicSdk_SonicSession: onClientRequestResource called in TaskSchedulerFo. W/libEGL: load: so=libEGL_vr.so dlopen failed: library "libEGL_vr.so" not found D/SonicSdk_QuickSonicSession: session(113017) onClientRequestResource:url = http://doc.wesmartclothing.com/terms/wemeet.html I/SonicSdk_QuickSonicSession: session(113017) now wait for pendingWebResourceStream! W/libEGL: load: so=libEGL_vr.so dlopen failed: library "libEGL_vr.so" not found W/VideoCapabilities: Unrecognized profile/level 1/32 for video/mp4v-es W/VideoCapabilities: Unrecognized profile/level 32768/2 for video/mp4v-es W/VideoCapabilities: Unrecognized profile/level 32768/64 for video/mp4v-es W/VideoCapabilities: Unsupported mime video/mpeg W/VideoCapabilities: Unrecognized profile/level 0/0 for video/mpeg2 W/VideoCapabilities: Unrecognized profile/level 0/2 for video/mpeg2 W/VideoCapabilities: Unrecognized profile/level 0/3 for video/mpeg2 I/VideoCapabilities: Unsupported profile 5 for video/mpeg2 I/chatty: uid=10361(u0_a361) Chrome_InProcGp identical 2 lines I/VideoCapabilities: Unsupported profile 5 for video/mpeg2 W/VideoCapabilities: Unsupported mime video/vc1 W/VideoCapabilities: Unsupported mime video/vc1 W/VideoCapabilities: Unsupported mime video/x-pn-realvideo W/VideoCapabilities: Unsupported mime video/clic D/mali_winsys: EGLint new_window_surface(egl_winsys_display , void , EGLSurface, EGLConfig, egl_winsys_surface *, egl_color_buffer_format , EGLBoolean) returns 0x3000 I/VideoCapabilities: Unsupported profile 4 for video/mp4v-es W/libEGL: load: so=libEGL_vr.so dlopen failed: library "libEGL_vr.so" not found W/libEGL: load: so=libEGL_vr.so dlopen failed: library "libEGL_vr.so" not found W/cr_MediaCodecUtil: HW encoder for video/avc is not available on this device. W/libEGL: load: so=libEGL_vr.so dlopen failed: library "libEGL_vr.so" not found D/OpenGLRenderer: HWUI Binary is enabled W/InputMethodManager: startInputReason = 1 W/cr_CrashFileManager: /data/user/0/com.wesmartclothing.tbra/cache/WebView/Crash Reports does not exist or is not a directory W/libEGL: EGLNativeWindowType 0x7f90394010 disconnect failed W/libEGL: load: so=libEGL_vr.so dlopen failed: library "libEGL_vr.so" not found W/libEGL: load: so=libEGL_vr.so dlopen failed: library "libEGL_vr.so" not found D/SonicSdk_SonicServer: session(tbra_ed3dbfc8918ff3f0067aa75966efdc44) server connect cost = 332 ms. D/SonicSdk_SonicServer: session(tbra_ed3dbfc8918ff3f0067aa75966efdc44) server response cost = 24 ms. I/SonicSdk_SonicSessionConnection: internalGetCustomHeadFieldEtag ~ sonicEtag:null D/SonicSdk_SonicSession: session(113017) connection get header fields cost = 0 ms. D/SonicSdk_SonicSession: session(113017) connection set cookies cost = 0 ms. I/SonicSdk_SonicSession: session(113017) handleFlow_Connection: respCode = 200, cost 367 ms. I/SonicSdk_SonicSession: session(113017) handleFlow_Connection: cacheOffline is null. I/SonicSdk_QuickSonicSession: session(113017) handleFlow_FirstLoad:hasCompletionData=false. I/SonicSdk_QuickSonicSession: session(113017) handleFlow_FirstLoad:offline->null , so do not need cache to file. D/SonicSdk_SonicEngine: onSessionStateChange:session(113017) from state 1 -> 2 I/SonicSdk_QuickSonicSession: session(113017) have pending stream? -> true, cost 211ms. D/SonicSdk_SonicSession: session(113017) handleMessage: msg what = 6. I/SonicSdk_QuickSonicSession: session(113017) handleClientCoreMessage_FirstLoad:FIRST_LOAD_NO_DATA. I/SonicSdk_SonicSession: session(113017) setResult: srcCode=1000, finalCode=1000. E/SonicSdk_SonicSession: session(113017) setResult: notify fail as webCallback is not set, please wait! I/SonicSdk_SonicSessionStream: close: memory stream and socket stream, netStreamReadComplete=true, memStreamReadComplete=true I/SonicSdk_SonicSession: session(113017) onClose:offline->null , so do not need cache to file. E/SonicSdk_SonicSession: session(113017) onClose cost 0 ms. I/SonicSdk_SonicSession: session(113017) onClientPageFinished:url=http://doc.wesmartclothing.com/terms/wemeet.html. D/SonicSdk_SonicSession: onClientRequestResource called in TaskSchedulerFo. I/zygote64: Compiler allocated 6MB to compile void android.view.ViewRootImpl.performTraversals()

marlonlu commented 5 years ago

我们app会读取http header返回的编码,如果没有返回,则默认使用utf-8 一般遇到这类问题是页面返回了非utf-8编码,却没有在header里面指明

gleolee commented 4 years ago

就算是

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

只要是用SonicSession的方式加载url就会乱码,除了第一次,这个缓存真心搞不懂。