|
|
|
@ -27,7 +27,7 @@ class Oauth::CreateOrFindWechatAccountService < ApplicationService
|
|
|
|
|
cd = CharDet.detect(result['nickname'])
|
|
|
|
|
Rails.logger.info "encoding: #{cd['encoding']} confidence: #{cd['confidence']}"
|
|
|
|
|
decode_content =
|
|
|
|
|
if cd["encoding"] == 'GB18030' && cd['confidence'] > 0.8
|
|
|
|
|
if cd["encoding"] == 'GB18030' && cd['confidence'] > 0.8 || cd["encoding"] == 'IBM866'
|
|
|
|
|
result['nickname'].encode('UTF-8', 'GBK', {:invalid => :replace, :undef => :replace, :replace => ' '})
|
|
|
|
|
else
|
|
|
|
|
result['nickname'].force_encoding('UTF-8')
|
|
|
|
|