enriclluelles/route_translator

Restore URI.escape behaviour

mshka opened this issue ยท 0 comments

mshka commented

Hello ๐Ÿ‘‹
Thank you for maintaining this gem!!

I want to raise another issue similar to #179

After updating to the latest version there was another breaking change when handling spaces in translation files

[1] pry(main)> URI.escape('space ')
=> "space%20"
[2] pry(main)> CGI.escape('space ')
=> "space+"

URI.escape and CGI.escape are a bit different https://stackoverflow.com/questions/2824126/whats-the-difference-between-uri-escape-and-cgi-escape#answer-13059657 and using gsub on CGI.escape should be avoided IMO since one of the reasons URI.escape was marked as obsolete is because it's just a simple gsub so I would like to propose restoring URI.escape behavior by using addressable gem -- reason: as mentioned here The closest to the URI spec seems to be the Addressable gem -- it will restore the URI.escape behavior while keeping the code free from any offenses

I made a PR to illustrate this change: #180