Come posso usare HTTParty con codifica UTF-8?
Domanda
Ho un URL del tipo http://example.com/tag/София/new.json
e voglio fare una richiesta GET con HTTParty. Quando faccio:
HTTPArty.get " http://example.com/tag/София/new.json
ottengo:
URI::InvalidURIError at /
bad URI(is not URI?): link here
Tutte le idee su come gestire questa situazione?
Soluzione
Il serie afferma "codificare l'URL come UTF-8, quindi rappresentano più sequenze -byte come ottetti per cento escape ". Nel tuo caso,
http://example.com/tag/%D0%A1%D0%BE%D1%84%D0%B8%D1%8F/new.json
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow