We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
使用人脸识别SDK时发现创建人员库接口中文乱码,出现问题的版本为
<dependency> <groupId>com.tencentcloudapi</groupId> <artifactId>tencentcloud-sdk-java</artifactId> <version>3.0.111</version> </dependency>
出现问题的示例代码如下:
Credential cred = new Credential("secretId", "secretKey"); // 执行时替换为真实的秘钥 IaiClient iaiClient = new IaiClient(cred, "ap-shanghai"); String str = "China中国"; byte[] b = str.getBytes(StandardCharsets.UTF_8); // 这里打印出[67, 104, 105, 110, 97, -28, -72, -83, -27, -101, -67],确实是“China中国”的UTF-8编码 System.out.println(Arrays.toString(b)); String[] desc = new String[]{"test"}; CreateGroupRequest createGroupRequest = new CreateGroupRequest(); createGroupRequest.setFaceModelVersion("3.0"); createGroupRequest.setGroupExDescriptions(desc); createGroupRequest.setGroupId("test_test-test"); createGroupRequest.setGroupName(new String(b, StandardCharsets.UTF_8)); // 将GroupName赋为中文字符串 createGroupRequest.setTag("ThisIsATag"); CreateGroupResponse createGroupResponse = iaiClient.CreateGroup(createGroupRequest);
代码执行后,成功返回,但是去控制台上一看,人员库的名字是乱码,如下图:
The text was updated successfully, but these errors were encountered:
可能你的java环境默认的字符集不是utf8 今天刚提交了一个变更(将会包含在下个版本中),在发送请求时总是使用utf8,应该可以解决你这个问题
Sorry, something went wrong.
No branches or pull requests
使用人脸识别SDK时发现创建人员库接口中文乱码,出现问题的版本为
出现问题的示例代码如下:
代码执行后,成功返回,但是去控制台上一看,人员库的名字是乱码,如下图:
The text was updated successfully, but these errors were encountered: