Handling non-8-bit characters in HTTP headers.
Hi all,
When passing on the content of a file in a REST API call, I need to put the original file name in an HTTP header. As it happens, some file names have non-8-bit characters in them ("å", "ö", and the like), and these arrive garbled on the other side. Does anybody know the correct way to encode them (assuming they should be encoded at all)?
$zconvert(filename, "O", "UTF8") does not appear to be it. I'm leaning towards $zconvert(filename, "O", "URL"), but leaning isn't good enough.
Thanks,
Otto
Hi @Otto Medin !
HTTP is basically US ASCII 7bit with some "handcrafted" extensions
- somehow "UTF 7.6" 🤪 focussing on octets
it works for äöü but NOT for € (x20AC) >>> in URL %u20AC
for details: https://softwareengineering.stackexchange.com/questions/304419/what-encoding-are-the-http-status-and-header-lines
my hint: Try to avoid it in HTTP headers and stick with 7bit ASCII to be on the save side
browsers are less risk for problems but old applications are
Thanks, Robert, and sorry for the very late response!