Skip Menu |

This queue is for tickets about the HTTP-Message CPAN distribution.

Report information
The Basics
Id: 69078
Status: resolved
Priority: 0/
Queue: HTTP-Message

People
Owner: Nobody in particular
Requestors: mark [...] blackmans.org
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 6.00
Fixed in: (no value)



Subject: form-data Content-Type doesn't seem to permit setting charset for individual content fields
Although the HTML 4.01 spec and the HTTP 1.1 spec refer to being able to set the charset for individual form-data encoded controls, POST in HTTP::Request::Common doesn't seem to have any way of specifying the charset per field. In particular, the content field might have wide characters that I want to encode and transmit. POST $url, Content => [ surname => encode('utf8',"Jędrejek"), b64_data => $base64_string ], Content_Type => 'form-data'; The receiving doesn't know what encoding was used for surname in the case above. Perhaps the following syntax instead? Content => [ surname => { Content => $encoded_string, Content_Type=> 'text/plain; charset='utf8' }, b64_data => $base64_string ] Regrettably I've no patch to offer. Perhaps there is a way to achieve this currently, but I didn't work it out.
From: mark [...] blackmans.org
Reading more carefully, there is actually a work-around that is very much like the suggested syntax. { surname => [undef,"t1.txt",Content=>encode("utf8","Jędrejek"),Content_Type=>"text/plain; charset=utf8"] } On Fri Jun 24 10:46:50 2011, mark@blackmans.org wrote: Show quoted text
> Although the HTML 4.01 spec and the HTTP 1.1 spec refer to being able > to set the > charset for individual form-data encoded controls, POST in > HTTP::Request::Common > doesn't seem to have any way of specifying the charset per field. > > In particular, the content field might have wide characters that I > want to encode > and transmit. > > POST $url, Content => [ surname => encode('utf8',"Jędrejek"), b64_data > => $base64_string > ], Content_Type => 'form-data'; > > The receiving doesn't know what encoding was used for surname in the > case above. > > Perhaps the following syntax instead? > > Content => [ surname => { Content => $encoded_string, Content_Type=> > 'text/plain; > charset='utf8' }, b64_data => $base64_string ] > > Regrettably I've no patch to offer. Perhaps there is a way to achieve > this currently, but I didn't > work it out.
From: mark [...] blackmans.org
that form means the server treats those as file uploads rather than parameters though. On Fri Jun 24 11:01:14 2011, mark@blackmans.org wrote: Show quoted text
> Reading more carefully, there is actually a work-around that is very > much like the suggested > syntax. > > { surname => > [undef,"t1.txt",Content=>encode("utf8","Jędrejek"),Content_Type=>"text/plain; > charset=utf8"] } > > > On Fri Jun 24 10:46:50 2011, mark@blackmans.org wrote:
> > Although the HTML 4.01 spec and the HTTP 1.1 spec refer to being
> able
> > to set the > > charset for individual form-data encoded controls, POST in > > HTTP::Request::Common > > doesn't seem to have any way of specifying the charset per field. > > > > In particular, the content field might have wide characters that I > > want to encode > > and transmit. > > > > POST $url, Content => [ surname => encode('utf8',"Jędrejek"),
> b64_data
> > => $base64_string > > ], Content_Type => 'form-data'; > > > > The receiving doesn't know what encoding was used for surname in the > > case above. > > > > Perhaps the following syntax instead? > > > > Content => [ surname => { Content => $encoded_string, Content_Type=> > > 'text/plain; > > charset='utf8' }, b64_data => $base64_string ] > > > > Regrettably I've no patch to offer. Perhaps there is a way to
> achieve
> > this currently, but I didn't > > work it out.
> >