troch / route-node

A package to create a tree of named routes
MIT License
20 stars 15 forks source link

BUG: errors handling unicode emoji #39

Open veesahni opened 3 years ago

veesahni commented 3 years ago

Route Node Version: 4.1.1 Node Version: 12.16.3

Reproducible code:

      const rootNode = new RouteNode('', '', [new RouteNode('users', '/users?:q')])
      console.log(rootNode.buildPath('users', { q: 'test漢字' }))
      // outputs: /users?q=test%E6%BC%A2%E5%AD%97
      console.log(rootNode.buildPath('users', { q: '60ad50🚀' }))
      // outputs: /users?q=60ad50%F0%9F%9A%80
      rootNode.setPath('/')
      console.log(rootNode.buildPath('users', { q: 'test漢字' }))
      // outputs: /users?q=test%E6%BC%A2%E5%AD%97
      console.log(rootNode.buildPath('users', { q: '60ad50🚀' }))
      // EXCEPTION: Uncaught URIError: URI malformed

Discussion:

martinklepsch commented 8 months ago

Is there any chance this might get fixed in a future release?