Closed dselivanov closed 4 years ago
Answers:
1:
Please note that the URL you use is invalid - only ASCII character are allowed in URLs. httr does not process the URL nor does it encode it, so your invalid URL is passed as-is. If you want to pass non-ASCII characters in URLs, you have to encode them and handle the encoding on the receiving end as well - see RFC2396
2:
HTTP doesn't support anything other than ASCII in URLs - there is no provision to declare encoding in the URL. Only HTTP request body can specify encoding, so that's the only way to reliably transport non-ASCII content. Some browsers will re-code URLs typed by the user in UTF-8 byte sequences (using the
%xx
byte representation) in that case you have to make sure you interpret the payload in UTF-8 and not any other non-UTF-8 locale. In addition, if you want the output to be treated correctly, you have to also declare the response encoding accordingly - e.g. above you have to addresponse$content_type="text/html; charset=UTF-8"
and depending on the locale you run R in you may have to make sure your objects are in UTF-8 encoding. Please refer to R documentation on character encoding and associated functions.
love this issue
moved from #109
here's hello world built in example RestRserve.
And i request to endpoint this
/hello/path/{name}
using/hello/path/안녕
.but request using httr, It's fine.
here's hello world code example.
Originally posted by @mrchypark in https://github.com/rexyai/RestRserve/issues/109#issuecomment-590407868