收藏
回答

Java后端发送订阅消息成功但是微信卡片显示问号?

只有数字正常显示


Http请求工具

public static String doPost(String url,Map<String,Object> paramMap){
    String result = null;
    if (url == null || url.isEmpty()){
        return null;
    }
    try {
        HttpPost httpPost = new HttpPost(url);
        httpPost.setHeader("Content-Type", "application/json");
        if (paramMap != null){
            String json = JSONObject.toJSONString(paramMap);
            HttpEntity entity = new StringEntity(json);
            log.info(json);
            httpPost.setEntity(entity);
        }
        CloseableHttpClient httpClient = HttpClients.createDefault();
        CloseableHttpResponse response = httpClient.execute(httpPost);
        log.info("地址" + url);
        log.info("版本:" + response.getVersion());
        log.info("状态码:" + response.getCode());
        result = EntityUtils.toString(response.getEntity(),"utf-8");
    }catch (Exception e){
        log.error(e.toString());
    }
    return result;
}


传入微信的body

{"touser":"*********-hU9FkA","data":{"character_string1":{"value":40},"thing8":{"value":**********},"thing12":{"value":"测试123"},"time14":{"value":"2024-05-06 14:42:51"}},"template_id":"*******","miniprogram_state":"formal","page":"*******","lang":"zh_CN"}


微信返回结果

{"errcode":0,"errmsg":"ok","msgid":3445796910676901892}

最后一次编辑于  05-06
回答关注问题邀请回答
收藏

1 个回答

  • 一笑皆春
    一笑皆春
    05-06

    发送时 设置UTF-8格式试试

    05-06
    有用 1
    回复
登录 后发表内容