W3C home > Mailing lists > Public > www-talk@w3.org > September to October 2008

UTF-8 and POST request

From: Andre-John Mas <ajmas@sympatico.ca>
Date: Mon, 6 Oct 2008 23:28:54 -0400
Message-Id: <7D3CAAA8-0B6D-45CC-9DCC-27E219C62820@sympatico.ca>
To: www-talk@w3.org

Hi,

I am in the process of converting my web site to be UTF-8 compliant,  
so that it can better handle scripts used by various languages. To be  
clear I am using a Java application server and by default it only  
accepts ISO-8859-1 for POST requests. In order to be able to have it  
treat the request parameters as UTF-8 I have to call the

   request.setCharacterEncoding("UTF-8")

each time I receive the parameters. I would have preferred an option  
to tell my application server to default to treating all post content  
as UTF-8, but this was rejected based on RFC 2616, section 3.7.1 and  
3.4.1.

I decided to try to specify the charset as part of the form's enctype  
attribute:

    <form action="" method="post" enctype="application/x-www-form- 
urlencoded; charset=utf-8">

though having tested with Safari, Firefox and Opera, I found that only  
Opera included the "charset=utf-8" component in the content-type of  
the request. Additionally if I specify

   <form action="" method="post" enctype="application/x-www-form- 
urlencoded; charset=utf-8" accept-charset="utf-8">

I get other strange results with Firefox and Safari. With Opera I just  
see questions marks when I pass my Japanese character test case.

Now to the questions:

  - should web browsers be acknowledging the charset attribute  
specified in the form, and sending them to the HTTP server?
  - is considered wrong to force my application to treat all requests  
as UTF-8?

André
Received on Tuesday, 7 October 2008 03:29:36 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 27 October 2010 18:14:29 GMT