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 => ' '})