网址链接中的中文编码

  • 中文的gbk(GB2312)编码: 一个汉字对应两组%xx,即%xx%xx
  • 中文的UTF-8编码: 一个汉字对应三组%xx,即%xx%xx%xx

可以利用百度进行URL编码解码 默认gbk

https://www.baidu.com/s?wd=%E4%B8%AD%E5%9B%BD

python3编码解码示例

# -*- coding: utf-8 -*-

# @File    : urldecode_demo.py
# @Date : 2018-05-11 from urllib.request import quote, unquote # 编码 url1 = "https://www.baidu.com/s?wd=中国" # utf8编码,指定安全字符
ret1 = quote(url1, safe=";/?:@&=+$,", encoding="utf-8")
print(ret1)
# https://www.baidu.com/s?wd=%E4%B8%AD%E5%9B%BD # gbk编码
ret2 = quote(url1, encoding="gbk")
print(ret2)
# https%3A//www.baidu.com/s%3Fwd%3D%D6%D0%B9%FA # 解码
url3 = "https://www.baidu.com/s?wd=%E4%B8%AD%E5%9B%BD" ret3 = unquote(url3, encoding='utf-8')
print(ret3)
# https://www.baidu.com/s?wd=中国
--------------------- 原文:https://blog.csdn.net/mouday/article/details/80278938

urlencode编码问题(以及urlparse) 转的更多相关文章

  1. urlencode编码问题(以及urlparse)

    # -*- coding: cp936 -*- #python 27 #xiaodeng #urlencode编码问题(以及urlparse) import sys, urllib def urlen ...

  2. 哪些字符需要urlencode编码?具体怎么处理?

    哪些字符需要urlencode编码?具体怎么处理? JS用escape()/encodeURI()/encodeURIComponent()方法编码,用unescape()/decodeURI()/e ...

  3. Js/Jquery- Base64和UrlEncode编码解码

    最近几天遇到一些URL参数明文显示的问题,因为是明文显示,容易让人通过改变参数查看到他没有权限看到内容. 一开始我的做法是自定义了规则,然后原始的那种URL编码.可是URL编译后效果不理想,他无法编译 ...

  4. urlencode编码,解码

    对字符串传入的字典参数进行urlencode编码,就需要用到两个方法urlencode和quoteurlencode方法传字典参数 from urllib.parse import urlencode ...

  5. 什么是urlencode编码

    今天看文章中看到了urlencode,不理解 ,故上网查了查,看到了如下的答案,在此记录下,以加深印象 urlencode编码:就是将字符串以URL编码,一种编码方式,主要为了解决url中中文乱码问题 ...

  6. HttpUtility.UrlEncode编码重写

    1. 某些系统方法,例如.NET系统方法HttpUtility.UrlEncode会将‘=’编码成‘%3d’,而不是%3D,导致加密签名通不过验证,请开发者注意检查. 2.Java 1.3和早期版本中 ...

  7. js Jquery字符UrlEncode 编码 C#(asp.net)解码 Server HttpUtility 区别 cookies存中文

    一.Js asp.net 交互Url编码解码 C#(asp.net)编码:HttpUtility.UrlEncode(url) Jquery解码:decodeURIComponent(url); Jq ...

  8. [SoapUI] UrlEncode编码/UrlDecode解码网站

    http://tool.chinaz.com/Tools/URLEncode.aspx 解码: 编码:

  9. quote(),unquote(),urlencode()编码解码

    quote(),unquote(),quote_plus(),unquote_plus(),urlencode() ,pathname2url(),url2pathname() urllib中还提供了 ...

随机推荐

  1. CentOS7 启动docker.service失败(code=exited, status=1/FAILURE)

    启动报错 Job for docker.service failed because the control process exited with error code. See "sys ...

  2. AntD02 Table组件的使用

    1 前提准备 1.1 创建一个angular项目 1.2 将 Ant Design 整合到 Angular 项目中 1.3 官方文档 点击前往 2 简单使用 <nz-table #rowSele ...

  3. 532. K-diff Pairs in an Array绝对值差为k的数组对

    [抄题]: Given an array of integers and an integer k, you need to find the number of unique k-diff pair ...

  4. C#实现访问网络共享文件夹

    C#实现访问网络共享文件夹,使用 WNetAddConnection2A 和 WNetCancelConnection2A. 在目标服务器建立共享文件夹,建立访问账号test; public enum ...

  5. python日期,时间函数

    获取当前格式化时间: now_time = time.strftime("%Y-%m-%d %H:%M:%S",time.localtime()) 获取当前时间戳: now_tim ...

  6. 基于django rest framework做认证组件

    先导入要用到的类 from rest_framework.authentication import BaseAuthentication from rest_framework.exceptions ...

  7. Servlet中response对象Commit状态的分析

    response是服务端对客户端请求的一个响应,其中封装了响应头.状态码.内容(也就是最终要在浏览器上显示的HTML代码或者其他数据格式)等. 服务端在把response提交到客户端之前,会使用一个缓 ...

  8. SpringMVC——数据转换 & 数据格式化 & 数据校验

    一.数据绑定流程 1. Spring MVC 主框架将 ServletRequest 对象及目标方 法的入参实例传递给 WebDataBinderFactory 实例,以创 建 DataBinder ...

  9. php系统常量

    (1)__FILE__ :php程序文件名.它可以帮助我们获取当前文件在服务器的物理位置. (2)__LINE__ :PHP程序文件行数.它可以告诉我们,当前代码在第几行. (3)PHP_VERSIO ...

  10. GCC 4.7相对4.6.x的改进点

    原文:http://www.iteye.com/news/24628针对C的功能改进: 支持ISO C11标准中的更多特性.除了之前的-std=c1x和-std=gnu1x选项外,GCC现在还支持-s ...