java网络编程之application/x-www-form-urlencoded MIME
来源:互联网 发布:58上面网络销售可靠吗 编辑:程序博客网 时间:2024/05/17 08:43
URLEncoder和URLDecoder用于完成普通字符串和application/x-www-form-urlencoded MIME字符串之间的相互转换.
编码和解码:
在Web的浏览器中,不同的浏览器的编码和解码规则是不一样的.
对于W3C浏览器:遵循W3C组织规范的浏览器,(非IE).
编码:byte[] data = “杨哥”.getByte(String charsetName);
解码:String str = new String(data, String charsetName);
对于IE浏览器:
编码使用的application/x-www-form-urlencoded MIME机制.
import java.net.URLDecoder;import java.net.URLEncoder;public class URLecodeDemo {public static void main(String[] args) throws Exception {String name = "杨哥 sunshine";//编码String encode = URLEncoder.encode(name, "UTF-8");System.out.println(encode);//%E6%9D%A8%E5%93%A5+sunshine//解码String decode = URLDecoder.decode(encode, "UTF-8");System.out.println(decode);//杨哥 sunshine}}
阅读全文
0 0
- java网络编程之application/x-www-form-urlencoded MIME
- application/x-www-form-urlencoded
- application/x-www-form-urlencoded
- application/x-www-form-urlencoded
- application/x-www-form-urlencoded
- application/x-www-form-urlencoded
- application/x-www-form-urlencoded
- application/x-www-form-urlencoded
- application/x-www-form-urlencoded
- application/x-www-form-urlencoded
- application/x-www-form-urlencoded
- application/x-www-form-urlencoded
- Form元素application/x-www-form-urlencoded
- application/x-www-form-urlencoded 字符编码
- Content-Type: application/x-www-form-urlencoded
- 关于application/x-www-form-urlencoded编码
- 关于application/x-www-form-urlencoded
- 读书笔记-java网络编程-5URL和URI-x-www-form-urlencoded
- 11.7-全栈Java笔记:如何实现线程同步
- 浏览器渲染页面原理
- 秒变配色高手!怎么都不会错的6条网页设计配色原则
- 【C++】构造拷贝构造的 N 中调用情况
- 在Ubuntu 14.04.2 LTS上安装Qt
- java网络编程之application/x-www-form-urlencoded MIME
- Apache Jmeter入门
- Webstorm 2016 full version activation code for free
- Java中解压文件名有中文的rar包出现乱码问题的解决
- Apache Jmeter进阶-RPC服务压测
- 线性表的顺序存储
- 堆栈内存区别
- u-boot移植详解
- [leetcode]85. Maximal Rectangle(Java)