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.

Encoding name normalization does not remove year suffix

See original GitHub issue

This line is supposed to normalize encoding names by removing non-alphanumeric characters and stripping an appended year. The year is not being stripped with the current regex, causing encoding names with years to not match.

Example: Input: iso_8859-5:1988 Output: iso885951988 Expected output: iso88595

I think the reason the current regex does not work is that the colon character is matched in the first part as a non-alphanumeric character, therefore causing the following year part to not match.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
ashtuchkincommented, Jul 5, 2017

Thanks guys, I think you’re right, I’ll add a fix soon.

– Alexander Shtuchkin

On Wed, Jul 5, 2017 at 11:26 AM, Erik Kemperman notifications@github.com wrote:

Just noticed the same thing. Suggested fix:

.toLowerCase().replace(/:\d{4}$/, “”).replace(/[^0-9a-z]/g, “”);

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/ashtuchkin/iconv-lite/issues/156#issuecomment-313186544, or mute the thread https://github.com/notifications/unsubscribe-auth/AAmVHYk30eR2uB93vvK3Kr06jEYV5yLcks5sK9VAgaJpZM4OMhuw .

0reactions
erikkempermancommented, Apr 7, 2018

Thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

FAQ - Normalization - Unicode
Q: What is normalization? Unicode encodes some text elements both as precomposed forms and as combining character sequences. The precomposed form has a ......
Read more >
Alma Normalization Rule Examples
Remove the last comma in 500 subfield a and do not touch the other commas. (it uses a temporary string with the comma...
Read more >
What is normalized UTF-8 all about? - Stack Overflow
Normalization is an attempt at dealing with that. Normalizing assures (or at least tries to) that all the characters are encoded the same...
Read more >
encoding/xml: empty namespace prefix definitions should be ...
It says "The attribute's normalized value MUST be either a URI reference — the namespace name identifying the namespace — or an empty...
Read more >
RFC 3986: Uniform Resource Identifier (URI): Generic Syntax
This specification does not define a generative grammar for URIs; ... Generic Syntax Each URI begins with a scheme name, as defined in...
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