收藏
回答

上传素材接口中上传视频title,description中文需要什么编码上传?

String encodedTitle = URLEncoder.encode(title, "UTF-8");
String encodedIntro = URLEncoder.encode(introduction, "UTF-8");

// 构造JSON参数字符串(已编码)
String jsonParam = String.format("{\"title\":\"%s\", \"introduction\":\"%s\"}",
    encodedTitle, encodedIntro);

// 构建请求实体
HttpEntity requestEntity = MultipartEntityBuilder.create()
    // 添加二进制文件
    .addBinaryBody("media", file)
    // 添加文本参数(已编码的JSON)
    .addTextBody("description", jsonParam)
    .build();
postRequest.setEntity(requestEntity);
CloseableHttpResponse response = httpClient.execute(postRequest);

 这样上传视频title会这样%E6%80%8E%E4%B9%88%E8%BF%98%E4%B8%8D%E8,


最后一次编辑于  2025-07-30
回答关注问题邀请回答
收藏

2 个回答

  • 智能回答 智能回答 本次回答由AI生成
    2025-07-30
    有用 1
  • Mr.Zhao
    Mr.Zhao
    2025-07-30

    postman会乱码吗

    2025-07-30
    有用
    回复 5
    • Veritas
      Veritas
      2025-07-30
      用api上传视频后去微信后台看会乱码
      2025-07-30
      回复
    • Mr.Zhao
      Mr.Zhao
      2025-07-30回复Veritas
      我说用postman
      2025-07-30
      回复
    • Veritas
      Veritas
      2025-07-30
      智能回答有用,已解决感谢
      2025-07-30
      回复
    • Mr.Zhao
      Mr.Zhao
      2025-07-30回复Veritas
      我都用resttemplate
      2025-07-30
      回复
    • Veritas
      Veritas
      2025-07-30回复Mr.Zhao
      👌
      2025-07-30
      回复
登录 后发表内容