Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

form-data Content-Type doesn't seem to permit setting charset for individual content fields [rt.cpan.org #69078]

Aperta
#49 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
35/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
perl
Ambito
api, backend

Direzione di ricerca

Inizia con POST in HTTP::Request::Common e segui come vengono rappresentati i campi form-data e come vengono emessi i relativi tipi di contenuto. Confronta il workaround esistente per il caricamento di file con il comportamento richiesto per i campi del modulo che non sono file; il lavoro è completato quando un campo può avere un charset esplicito senza essere trattato come un caricamento di file, con copertura per la sintassi proposta e il valore codificato.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Migrated from rt.cpan.org#69078 (status was 'new')

Requestors:

From [email protected] on 2011-06-24 14:46:50:

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 [email protected] on 2011-06-24 15:01:14:

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, [email protected] 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.


From [email protected] on 2011-06-24 15:21:52:

that form means the server treats those as file uploads rather than parameters though.

On Fri Jun 24 11:01:14 2011, [email protected] wrote:
> 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, [email protected] 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.
> 
> 


Lingua principale
Perl
Stelle
32
Fork
62
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di libwww-perl/HTTP-Message

Tutte le issue di libwww-perl/HTTP-Message

Issue simili

Altre issue su Perl

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.