question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

iso-8859-1/windows-1252 support?

See original GitHub issue

Hi,

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:open
  • Created 7 years ago
  • Reactions:4
  • Comments:10 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
Xtrem65commented, Jul 16, 2018

@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 ?

0reactions
papandreoucommented, Jul 17, 2018

@Xtrem65, you can help by trying it out 😃

  1. Make a clone of https://github.com/papandreou/qs
  2. Check out the feature/iso8859-1 branch
  3. npm link
  4. Make a clone of https://github.com/papandreou/body-parser
  5. Check out the feature/iso-8859-1/take2 branch
  6. npm link qs
  7. npm link
  8. cd to your project
  9. npm 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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Table Comparing Characters in Windows-1252, ISO-8859-1 ...
CP1252* CP1252* ISO 8859‑15 Unicode UTF‑8 bytes UTF‑8 bytes UTF‑8 b... (Dec.) (Hex) (Hex) (Hex) #1 #2 #3 128 80 A4 20AC E2 82 AC 129...
Read more >
Windows-1252 - Wikipedia
Windows -1252 or CP-1252 (code page 1252) is a single-byte character encoding of the Latin ... Language(s), Basically all supported by ISO/IEC 8859-1...
Read more >
Encoding iso-8859-1 to Windows-1252 - String Functions
Dec Hex iso‑8859‑1 Windows‑1252 64 40 @ @ 65 41 A A 66 42 B B
Read more >
What is the exact difference between Windows-1252(1/3/4 ...
It differs from ISO Latin 1, also known as ISO-8859-1 as a character encoding, so that the code range 0x80 to 0x9F is...
Read more >
ISO 8859-1 Windows-1252 Code page.
Does the scanner support ISO/IEC 8859-1and/or Code Page, CP 1252, ISO 8859? My Scanner does not transmit the correct characters when reading ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found