HttpListenerRequest.ContentEncoding プロパティ
アセンブリ: System (system.dll 内)

InputStream プロパティのデータへの使用に適した Encoding オブジェクト。

Encoding オブジェクトを使用して、バイト シーケンスを文字セット (コード ページ) に変換したり、文字をバイト シーケンスに変換したりできます。このプロパティは、Content-Type ヘッダーの文字セット値を使用して、エンコーディングを決定します。その情報が利用できない場合、このプロパティは Encoding.Default を返します。

ContentEncoding プロパティを使用したコード例を次に示します。
public static void ShowRequestData (HttpListenerRequest request) { if (!request.HasEntityBody) { Console.WriteLine("No client data was sent with the request."); return; } System.IO.Stream body = request.InputStream; System.Text.Encoding encoding = request.ContentEncoding; System.IO.StreamReader reader = new System.IO.StreamReader(body, encoding); if (request.ContentType != null) { Console.WriteLine("Client data content type {0}", request.ContentType); } Console.WriteLine("Client data content length {0}", request.ContentLength64); Console.WriteLine("Start of client data:"); // Convert the data to a string and display it on the console. string s = reader.ReadToEnd(); Console.WriteLine(s); Console.WriteLine("End of client data:"); body.Close(); reader.Close(); // If you are finished with the request, it should be closed also. }

Windows 98, Windows Server 2003, Windows XP Media Center Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


Weblioに収録されているすべての辞書からHttpListenerRequest.ContentEncoding プロパティを検索する場合は、下記のリンクをクリックしてください。

- HttpListenerRequest.ContentEncoding プロパティのページへのリンク