最近项目需要用到unionid,故对encryptedData 进行解密操作,encryptedData,session_key,iv已正常拿到,解密出的字符串数据,nickName是中文而导致乱码,但某些用户,nickName乱码后会导致nickName对象的数据少个"引号从而导致转JSON对象失败报异常,下面放截图。
正常的数据:
{"openId":"o80ME5lIrkOg0mVw9jn2l0QcEz-g","nickName":"bocn","gender":1,"language":"zh_CN","city":"Haikou","province":"Hainan","country":"China","avatarUrl":"https://thirdwx.qlogo.cn/mmopen/vi_32/Q0j4TwGTfTJnd1BOQXoe1OwqW1VWmtKd8XRPERomtQ1ykacCr09KLSAkNyZvrq9P8V1APUwrricVhKY8wtLWiaqw/132","unionId":"oaDqW6KKh14nlRqPWLuwkNDkG2b0","watermark":{"timestamp":1602294120,"appid":"wxa7d216c55bad2edb"}}
异常的数据:
{"openId":"o80ME5qCi7U6QaSsqJpDTfVHWjgw","nickName":"宀佹湀鏄妸鏉?尓鍒?,"gender":1,"language":"zh_CN","city":"East","province":"Hainan","country":"China","avatarUrl":"https://thirdwx.qlogo.cn/mmopen/vi_32/Q0j4TwGTfTKABUOialWDJn1T2aWjiaAonickP34X6gibicp9qerPvnA74C6N9XHQH6p3dtp9LY6tvWVony0W9h4LnSg/132","unionId":"oaDqW6BPlOKL9KXgmRCzgiEgs6KQ","watermark":{"timestamp":1602293682,"appid":"wxa7d216c55bad2edb"}}
这个nickName是纯中文的,但是开发中发现有些用户nickName是纯中文乱码,引号也正常返回的。
在此求助各位。。。