Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

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

オープン
#49 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
35/100
issue の種類
機能追加
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
perl
領域
api, backend

調査の方向性

HTTP::Request::Common の POST から始め、form-data フィールドがどのように表現され、その Content-Type がどのように出力されるかを追跡します。既存のファイルアップロード用 workaround と、要求されているファイルではないフォームフィールドの動作を比較します。完了の条件は、フィールドが明示的な charset を持て、それでもファイルアップロードとして扱われないことです。提案された構文とエンコードされた値もカバレッジに含めます。

索引モデルが issue の本文から書いたものです。

説明

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


主要言語
Perl
スター
32
フォーク
62
PR マージ指標
30日以内にマージされた PR はありません

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

libwww-perl/HTTP-Message のほかの issue

libwww-perl/HTTP-Message の issue をすべて見る

似ている issue

Perl の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。