-
Notifications
You must be signed in to change notification settings - Fork 5.4k
URI::Generic#to_s encoding incompatible #1188
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
What problem do you have by this difference? |
Thank you for your reply. In the deprecated method Example CodeI expect that multi-byte characters ('日本語') will be decoded. require 'uri'
p RUBY_VERSION
str = URI::Generic.build(scheme: 'http', host: 'localhost', path: '/test', query: 'language=日本語').to_s
p URI.decode(str) Run with Ruby 2.2.4It's just as I expected. "2.2.4"
"http://localhost/test?language=日本語" Run with Ruby 2.3.0I did not expect this. "2.3.0"
"http://localhost/test?language=\xE6\x97\xA5\xE6\x9C\xAC\xE8\xAA\x9E" I prefer to use non-deprecated method, for example On the one hand, I think the problem with this change is incompatibility with existing libraries. Thanks. |
The encoding of escaped URI should be US-ASCII, and maybe URI.decode should set the resulted encoding as UTF-8. Is this solve the issue? Anyway fog uses the resulted string as filename. What your purpose of the decoded string? |
That makes sense. It will be no problem if URI.decode should set the resulted encoding as UTF-8. |
@nurse May I close this PR? |
After some additional thought, I merged it to backport 2.3. |
Appreciate it, many thanks. |
UTF-8 as Ruby 2.2/ by Koichi ITO <koic.ito@gmail.com> ruby#1188 fix rubyGH-1188 git-svn-id: svn+ssh://svn.ruby-lang.org/ruby/trunk@53535 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
UTF-8 as Ruby 2.2/ by Koichi ITO <koic.ito@gmail.com> ruby#1188 fix rubyGH-1188 git-svn-id: svn+ssh://svn.ruby-lang.org/ruby/trunk@53535 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
UTF-8 as Ruby 2.2/ by Koichi ITO <koic.ito@gmail.com> ruby/ruby#1188 fix GH-1188 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53535 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Is this intentionally changed?
Ruby 2.2.4
Ruby 2.3.0
This patch is compatible with Ruby 2.2.
Thanks.