Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

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

Đang mở
#49 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
35/100
Loại issue
Tính năng
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
perl
Lĩnh vực
api, backend

Hướng nghiên cứu

Bắt đầu với POST trong HTTP::Request::Common và theo dõi cách các trường form-data được biểu diễn cũng như cách các content type của chúng được phát ra. So sánh workaround tải tệp hiện có với hành vi được yêu cầu đối với trường biểu mẫu không phải tệp; được xem là hoàn tất khi một trường có thể mang charset tường minh mà không bị xử lý như một lượt tải tệp lên, với coverage cho cú pháp được đề xuất và giá trị đã mã hóa.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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.
> 
> 


Ngôn ngữ chính
Perl
Star
32
Fork
62
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của libwww-perl/HTTP-Message

Tất cả issue của libwww-perl/HTTP-Message

Issue tương tự

Thêm issue về Perl

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.