使用字符集windows-1251处理req时出错

Error while process req with charset windows-1251

本文关键字:req 出错 处理 windows-1251 字符集      更新时间:2023-09-26

我有一个用node.js express.js编写的服务我从另一个在线服务收到http请求。这是标题:

{ 
'content-type': 'application/x-www-form-urlencoded; charset=windows-1251',
  host: 'swift-language.info:3030',
  'content-length': '614',
  connection: 'Keep-Alive'
}

带有415错误和express的body解析器响应不调用我的路由。我想问题出在charset=windows-1251

您说得对,body-parser当前不支持非UTF8字符集。然而,busboy(以及基于它构建的其他模块,如connect busboy或express busboy)除了支持节点内置的字符集之外,还支持许多字符集。