解决 get 提交的乱码 (手工处理) String username = request.getParameter("username"); username = new String(user.getBytes("iso8859-1"),"UTF-8"); System.out.println(username); 解决 post 提交的乱码 request.setCharacterEncoding("UTF-8"); S
今天工作的时候遇到一个坑,在客户端用nodejs给服务器发送HTTP请求,服务器老是报错:In the context of Data Services an unknown internal server error occurred 经过服务器端调试发现,服务器根本就没有正确解析出这个请求的content-type.在postman里能工作的场景下,正确解析出的content-type是multipart/mixed: 而我的nodejs代码里明明指定了这个content-type的啊? 经
var req = http.get(url,function(res){ res.setEncoding('utf-8'); var html = '' res.on('data',function(data){ html+=data.toString(); }).on('end',function(){ console.log(html); }) });