Davis Frank wrote:
URI#escape escapes to UTF-8. I need to escape to Latin-1 for Amazon’s
REST API. Is there another library I can use? There doesn’t seem to be
a way to change what URI#escape uses (at least, not from the skeleton
std API docs).
I’m getting very little to go on via searching.
URI#escape escapes to UTF-8 because your string is UTF-8-encoded. Use
iconv, as Alex suggested, to re-encode it to Latin-1, or do it with
unpack and pack
and then apply URI#escape.
Of course, both methods will fail if any character in your string is
outside the Latin-1 range.