当前位置:网站首页>restTemplate返回字符乱码问题
restTemplate返回字符乱码问题
2022-07-21 10:30:00 【haohaounique】
1.乱码原因返回的中文以ISO_8859_1编码返回,编码转换即可
new String(body.getBytes(StandardCharsets.ISO_8859_1), StandardCharsets.UTF_8);
具体解决实例如下
RequestEntity<String> gh = RequestEntity.post(new URI("")).header("GH", "").body("");
ResponseEntity<String> exchange = restTemplate.exchange(gh, String.class);
String body = exchange.getBody();
String s = new String(body.getBytes(StandardCharsets.ISO_8859_1), StandardCharsets.UTF_8);
另外乱码2情况,经过url编码的解码即可
URLDecoder.decode("", StandardCharsets.UTF_8.toString());
边栏推荐
- 打造一个生命周期感知的MVP架构
- jenkins:构建的时候进入子目录然后在进行mvn操作
- 网络开发包 libpcap
- 为配置SSL,自制CA证书
- 剑指 Offer 49. 丑数
- Codeql usage process
- matplotlib. Pyplot interface summary
- Yuanqi Digitalization: existing mode or open source innovation Lixia action
- 旋转矩阵推导过程
- Introduction to pytorch II use pyplot to dynamically show the function fitting process
猜你喜欢
行业分析| 物流对讲
From scratch implement crnn using pytorch: read training data
Basic process of generating digital image
day 2
Use of delete
In depth discussion on image correction + text correction technology
Bootloader series I -- Analysis of ARM processor startup process
[machine learning] dimension reduction technology PCA
【论文笔记】ObjectBox: From Centers to Boxes for Anchor-Free Object Detection
博物馆数字化——数字藏品app开发
随机推荐
博物馆数字化——数字藏品app开发
ECCV 2022 | multi domain long tailed distributed learning to solve the problem of unbalanced domain generalization
如何使用界面控件Telerik UI for WinForms开发步骤进度条?
MySQL存储引擎大全
2019 Hangdian multi school sixth session 6641 (original 1008) TDL (regular question)
直接使用CRecordset,不使用CRecordset的派生类
工作流引擎在vivo营销自动化中的应用实践 | 引擎篇03
防止静态反编译及动态反调试,反外挂
剑指 Offer 48. 最长不含重复字符的子字符串
Linux uses Yum to quickly install mysql
Detailed explanation of depthwise separable revolution
B站自定义倍数代码
MySQL45讲笔记-字符串前缀索引&MySQL刷脏页分析
MySQL storage engine Encyclopedia
问一下REITs是什么呢?请问,手机开户股票开户安全吗?
open和fopen的区别
Day 9 (this关键字与实验)
Text detection - traditional
Anaconda common commands
[untitled]