iso-8859-1/windows-1252 support?
See original GitHub issueHi,
A while ago I developed a web app to replace an old cgi-bin script from the nineties, which means that it had to assume that POST requests with a Content-Type
of application/x-www-urlencoded
are in iso-8859-1
(and also support “smart quotes” etc., aka. windows-1252). At the same time it had to be possible to switch to utf-8
mode.
I accomplished that by adding support for a defaultCharset
option, which can either be utf-8
or iso-8859-1
, and for explicitly switching to utf-8
mode by adding utf8=%E2%9C%93
(utf8=✓
as percent-encoded utf-8 octets) to the query string, a trick that I’ve seen others use as well.
Here are the diffs between my forks of body-parser and the qs module:
https://github.com/expressjs/body-parser/compare/master...papandreou:iso-8859-1 https://github.com/ljharb/qs/compare/master...papandreou:interpretNumericEntities
Would anyone be interested in this work? If so, I can clean it up and open PRs.
Issue Analytics
- State:
- Created 7 years ago
- Reactions:4
- Comments:10 (3 by maintainers)
Top GitHub Comments
@dougwilson Any update on this ?
I’m interested in this feature but as @papandreou 's branch is way behind the official master. Seems like it’s going to be hard to pull…
Is there any proper other way to handle ISO-8859-1 encoded data ?
@Xtrem65, you can help by trying it out 😃
feature/iso8859-1
branchnpm link
feature/iso-8859-1/take2
branchnpm link qs
npm link
cd
to your projectnpm link body-parser
… Then see if you can solve your problem. Depending on the requests that you need to support, you might have to specify the
defaultCharset
option.