开发者

How can I use HTTParty with UTF-8 encoding?

开发者 https://www.devze.com 2022-12-15 16:16 出处:网络
I have a URL like http://example.com/tag/София/new.json and I want to make a GET request with HTTParty. When I do:

I have a URL like http://example.com/tag/София/new.json and I want to make a GET request with HTTParty. When I do:

HTTPArty.get "http://开发者_运维技巧example.com/tag/София/new.json

I get:

URI::InvalidURIError at /
bad URI(is not URI?): link here

Any ideas how to handle this ?


The standard says "encode the URL as UTF-8, then represent multi-byte sequences as percent-escaped octets." In your case,

http://example.com/tag/%D0%A1%D0%BE%D1%84%D0%B8%D1%8F/new.json
0

精彩评论

暂无评论...
验证码 换一张
取 消