企业微信会话内容存档调用DecryptData返回中文出现乱码

小游戏 企业微信 微信支付 小程序 文章 2020-07-30 21:03 2067 0 全屏看文

AI助手支持GPT4.0

企业微信会话内容存档调用DecryptData返回中文出现乱码
问题类型 API/组件名称 终端类型 微信版本 基础库版本
Bug 企业微信会话存档sdk 工具

我用c#开发会话存档功能,调用官方c的dll,使用解密方法DecryptData返回msg,再调用GetContentFromSlice(msg)出现部分中文乱码。

双数中文字的时候不会乱码,例:“您好”。单数中文字的时候最后一个字是乱码,例:“麻烦提供下截�?”,(原文:麻烦提供下截图)。

而且乱码的那条数据最后的双引号也没有返回,导致不能正常转成json格式,如下图:

之前开发了个java的版本,一切正常可以返回正常的中文数据。

同一条会话数据,用java中运行出来的encrypt_key、encrypt_msg和c#运行出来的encrypt_key、encrypt_msg一致,但是c#调用解密方法后就会出现前面说的情况。

是c#调用dll里的方法有什么前提需求吗?

Problem type API / component name terminal type wechat version basic library version bug enterprise wechat session archiving SDK tool no no no I use C ා to develop session archiving function, call the official C DLL, use decrypt method decryptdata to return MSG, and then call getcontentfromslice (MSG) to generate some Chinese garbled code. Even Chinese characters will not be garbled, for example: "hello". The last word in the singular number of Chinese characters is a garbled code, for example: "please provide the next section?". Moreover, the last double quotation mark of the garbled data is not returned, which results in the failure to convert to JSON format. As shown in the following figure: a java version was developed before, and normal Chinese data can be returned if everything is normal. For the same session data, use the encrypt run in Java_ key、encrypt_ Encrypt from MSG and C ා_ key、encrypt_ MSG is consistent, but C ා calls the decryption method, and the above situation will appear. Is it C ා calling the method in DLL? Do you have any prerequisite requirements?

回答:

企业微信运营专员-千夜:

您好,麻烦提供下使用的是否是java 版本sdk,以及是win还是linux环境, jdk版本

Lurv ⁺¹:c和java的sdk都调用尝试了,结果一样。
win环境
c#编码。不是java
way1 on load (^_^):

感觉肯定是C#中的编码问题了,我用java版本也是正常的

Lurv ⁺¹:java的sdk和c的DecryptData方法参数不一样,我用c#调java的DecryptData方法时出现了你提问中的10008,请问这个错误码是因为啥?

-EOF-

AI助手支持GPT4.0