From 52528fa4c1fc03b9fa4234e7f0f2eb642fbd4b21 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Tue, 26 Nov 2019 17:15:11 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B0=8F=E7=A8=8B=E5=BA=8F=E8=B0=83=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/libs/wechat/weapp.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/libs/wechat/weapp.rb b/app/libs/wechat/weapp.rb index aed14128b..0a1cc5eed 100644 --- a/app/libs/wechat/weapp.rb +++ b/app/libs/wechat/weapp.rb @@ -24,7 +24,7 @@ class Wechat::Weapp def decrypt(session_key, encrypted_data, iv) session_key = Base64.decode64(session_key) encrypted_data = Base64.decode64(encrypted_data) - cd = CharDet.detect(content) + cd = CharDet.detect(encrypted_data) encrypted_data = if cd["encoding"] == 'GB18030' && cd['confidence'] > 0.8 encrypted_data.encode('UTF-8', 'GBK', {:invalid => :replace, :undef => :replace, :replace => ' '})