Hi,
I’m not sure if it is a bug or a feature: when I use
http_parameters(Request,
[
result(Result, [length<4096,optional(true)])
])
to extract a parameter from a request encoded as application/x-www-form-urlencoded; charset=UTF-8
[user(submeto),
protocol(http),
peer(ip(127,0,0,1)),
pool(client('httpd@8080',http_unix_daemon:http_dispatch,...,
method(post),
request_uri('/.../submeto.pl'),
path('/.../submeto.pl'),
http_version(1-1),
host(localhost),
port(8080),
authorization('Basic ...'),
user_agent('Mozilla/5.0 (X11; Ubuntu; Linux i686; rv:36.0) Gecko/20100101 Firefox/36.0'),
content_type('application/x-www-form-urlencoded; charset=UTF-8'),
x_forwarded_for('...'),
x_forwarded_host('...'),
x_forwarded_server('...'),
content_length(138),
connection('Keep-Alive')]
I get the parameter in latin1: Å\x9D\oveto instead of ŝoveto.
As a workaround I applied:
atom_codes(Result,Utf8),
phrase(utf8_codes(RCode), Utf8),
atom_codes(Res2,RCode),
which works as long as I expect a specific parameter posted in UTF-8. Not sure if a proper fix should be done in http_parameters instead or the client should send some additional information in order to get the decoding right.
Kind regards,
Wolfram.