Re: requestEncoding = "ISO-8859-1"



Thus wrote Mark,

I would love to remain with UTF-8 as well, but the scenario below
appears to require ISO-8859-x.

* Create a new web project with an .HTM page and a .ASPX page using
all the
defaults of VS.NET 2003.
* Put an HTML form on the HTM page. Send the results of the form
submission
to the .ASPX page.
* If the form includes any fun accents (Spanish names for example),
the
Request object on the .aspx page nukes them. The code below
illustrates
this.
* The client I'm using to test this is the latest patched version of
IE
(6.0.29.. SP2)
string Test1 = Request["FirstName"];

It was my understanding that UTF-8 should be all encompassing,
allowing for all of these other characters??? I'm very confused ...

Don't be. All that happens is that your HTML form likely doesn't specify any encoding, thus your browser assumes ISO-8859-1 by default (check your browser's encoding option after loading the form!).

HTML 4.01 even includes an attribute to specify the character encoding for a submitted web form ("accept-charset"), but last time I checked it was practically unsupported. What happens instead is that the original response encoding (ISO-8859-1 assumed if not specified) is used as subsequent request encoding.


Therefore, simply mark your static HTML as UTF-8 encoded as well (and of course encode them physically using UTF-8 as well!):

<META http-equiv="Content-Type" content="text/html; charset=UTF-8">

That should do the trick.
--
Joerg Jooss
news-reply@xxxxxxxxxxxxx


.



Relevant Pages

  • Re: client side script and encoding
    ... the only reason why I put the client-side script generation in an aspx page ... was to have better control of the IIS output encoding than a flat file gives ... Seeing the BOM in the stream, ...
    (microsoft.public.scripting.jscript)
  • RE: UTF-8 Encoding
    ... As for the encoding for ASPX page in VS.NET/ ASP.NET RUNTIME, ... The strings we hardcoded in code file .cs or .vb are compiled into bytes at ... UTF-8 encoded and batch convert a set of file to UTF-8? ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Wrong encoding reading form fields
    ... >I understand the use of Server.HtmlEncode when encoding an URL ... I can only use server code when reading form fields in ASPX ... >Nelson R. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: DotNet & Netscape4
    ... You can put in any HTML section of your ASPX page a LAYER, ... You can only make the test on a NETSCAPE4 browser since ... this is likely an encoding problem. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Request.QueryString() and/or Request.Form()
    ... I have an .htm page that uses an HTML form button to open my .aspx page in a new window without any ... That may be why I can't retrieve my hidden inputs in the HTML form, because, even ... >> Is it possible to retrieve HTML form variables that are hidden input types ...
    (microsoft.public.dotnet.framework.aspnet)