当前位置:网站首页>【问题解决】‘ascii‘ codec can‘t encode characters in position xx-xx: ordinal not in range(128)
【问题解决】‘ascii‘ codec can‘t encode characters in position xx-xx: ordinal not in range(128)
2022-04-23 20:12:00 【Ricce】
问题描述
今天在用 Python 调用百度地图 API 返回 JSON 数据时候遇到了以下问题:
'ascii' codec can't encode characters in position xx-xx: ordinal not in range(128)
解决方案
一开始以为是返回的数据有问题,后来一步步排查发现是自己构建 URL 的时候参数出现了问题,URL 中如果要出现中文,需要对中文进行转码:
Python:
urllib.parse.quote(value)
Java:
java.net.URLEncoder.encode("value",“utf-8")
版权声明
本文为[Ricce]所创,转载请带上原文链接,感谢
https://blog.csdn.net/zhang919568/article/details/124326989
边栏推荐
- Design of library management database system
- 基于pytorch搭建GoogleNet神经网络用于花类识别
- 微信中金财富高端专区安全吗,证券如何开户呢
- Shanda Wangan shooting range experimental platform project - personal record (V)
- Possible root causes include a too low setting for -Xss and illegal cyclic inheritance dependencies
- SRS deployment
- 如何在BNB鏈上創建BEP-20通證
- MySQL数据库 - 单表查询(二)
- Electron入门教程3 ——进程通信
- 图书管理数据库系统设计
猜你喜欢
selenium. common. exceptions. WebDriverException: Message: ‘chromedriver‘ executable needs to be in PAT
php参考手册String(7.2千字)
Openharmony open source developer growth plan, looking for new open source forces that change the world!
山东大学软件学院项目实训-创新实训-网络安全靶场实验平台(八)
selenium.common.exceptions.WebDriverException: Message: ‘chromedriver‘ executable needs to be in PAT
Possible root causes include a too low setting for -Xss and illegal cyclic inheritance dependencies
Compact CUDA tutorial - CUDA driver API
AQS learning
[report] Microsoft: application of deep learning methods in speech enhancement
山东大学软件学院项目实训-创新实训-网络安全靶场实验平台(六)
随机推荐
Project training of Software College of Shandong University - Innovation Training - network security shooting range experimental platform (V)
R语言使用econocharts包创建微观经济或宏观经济图、indifference函数可视化无差异曲线、自定义计算交叉点、自定义配置indifference函数的参数丰富可视化效果
[2022] regard 3D target detection as sequence prediction - point2seq: detecting 3D objects as sequences
R语言ggplot2可视化分面图(facet_wrap)、使用lineheight参数自定义设置分面图标签栏(灰色标签栏)的高度
MFC obtains local IP (used more in network communication)
MySQL数据库 - 单表查询(三)
Redis的安装(CentOS7命令行安装)
Scrum Patterns之理解各种团队模式
Wave field Dao new species end up, how does usdd break the situation and stabilize the currency market?
STM32 Basics
Redis distributed lock
Kibana reports an error server is not ready yet. Possible causes
Project training of Software College of Shandong University - Innovation Training - network security shooting range experimental platform (6)
NC basic usage 1
NC basic usage
波场DAO新物种下场,USDD如何破局稳定币市场?
Devops integration - environment variables and building tools of Jenkins service
DTMF dual tone multi frequency signal simulation demonstration system
Record: call mapper to report null pointer Foreach > the usage of not removing repetition;
R language ggplot2 visualization: ggplot2 visualizes the scatter diagram and uses geom_ mark_ The ellipse function adds ellipses around data points of data clusters or data groups for annotation