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.

Percent encoding support for URL path

See original GitHub issue

Seems there is no support for percent encoding either unencoded or encoded e.g.

const Path = require('path-parser');
new Path('🦄');
Error: Could not parse path '%F0%9F%A6%84'
    at tokenise (/Users/alextes/code/notepad/js/node_modules/path-parser/dist/cjs/path-parser.js:95:15)
    at new Path (/Users/alextes/code/notepad/js/node_modules/path-parser/dist/cjs/path-parser.js:166:23)

Since percent encoding is allowed in URLs and common in translated routes would you appreciate a PR that supports recognizing % as part of a fragment?

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
alextescommented, Jan 9, 2018

So with https://github.com/router5/router5/issues/63 this got implemented for parameters. This would be about supporting it in the fragment.

Maybe good to share that you call fragment is what the RFC calls path. A little confusing as there’s also URL fragments. From the RFC:

   The following are two example URIs and their component parts:

         foo://example.com:8042/over/there?name=ferret#nose
         \_/   \______________/\_________/ \_________/ \__/
          |           |            |            |        |
       scheme     authority       path        query   fragment
          |   _____________________|__
         / \ /                        \
         urn:example:animal:ferret:nose

I’d suggest updating that to match the RFC which talks about components 😁 .

0reactions
trochcommented, Jan 16, 2018

I’m of course happy to put in a PR with that change 😄 .

If you have time, definitely 👍

Read more comments on GitHub >

github_iconTop Results From Across the Web

Percent-encoding - Wikipedia
Percent -encoding, also known as URL encoding, is a method to encode arbitrary data in a Uniform Resource Identifier (URI) using only the...
Read more >
Percent-encoding - MDN Web Docs Glossary: Definitions of ...
Percent-encoding is a mechanism to encode 8-bit characters that have specific meaning in the context of URLs. It is sometimes called URL ...
Read more >
URL Encoding | Google Maps Platform
All characters to be URL-encoded are encoded using a '%' character and a two-character hex value corresponding to their UTF-8 character. For example,...
Read more >
HTML URL Encoding Reference - W3Schools
Character From Windows‑1252 From UTF‑8 space %20 %20 ! %21 %21 " %22 %22
Read more >
What is URL Encoding and How does it work? | URLEncoder
Decimal Character URL Encoding (UTF‑8) 0 NUL(null character) %00 1 SOH(start of header) %01 2 STX(start of text) %02
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