![](https://img-blog.csdnimg.cn/20201014180756916.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
Java
SheepX0128
You must start somewhere.
展开
-
Tomcat中文路径参数乱码问题
原因分析Http请求传输时将url以ISO-8859-1编码,服务器收到字节流后默认会以ISO-8859-1编码来解码成字符流(造成中文乱码)解决方法方法1: 手动转编码我们需要把request.getParameter(“参数名”)获取到的字符串先用ISO-8859-1编码成字节流,然后再将其用utf-8解码成字符流String str = new String(request.getParameter("参数名").getBytes("iso-8859-1"), "utf-8"); 方法2原创 2021-06-24 11:19:01 · 533 阅读 · 0 评论 -
2020-10-12
使用Java Client上传文件到HTTP Server的例子String url = "http://example.com/upload";String charset = "UTF-8";String param = "value";File textFile = new File("/path/to/file.txt");File binaryFile = new File("/path/to/file.bin");String boundary = Long.toHexString(转载 2020-10-12 15:07:32 · 49 阅读 · 0 评论