wrong encoding

Discussion in 'HTML' started by Hans Meier, Nov 9, 2003.

  1. Hans Meier

    Hans Meier Guest

    When I submit a form, Internet Explorer 6 encodes the form data á to %C3%A0
    in
    the URL. It should be %E1. What's wrong?

    %C3%A0 seams to be the Unicode character of á, but á is also in the ANSI
    character set (%E1).
     
    Hans Meier, Nov 9, 2003
    #1
    1. Advertising

  2. Hans Meier:

    > When I submit a form, Internet Explorer 6 encodes the form data á to %C3%A0
    > in the URL. It should be %E1. What's wrong?


    > %C3%A0 seams to be the Unicode character of á, but á is also in the ANSI
    > character set (%E1).


    It does indeed seem to be the Unicode, UTF-8, way to encode "á". If the
    page itself is in UTF-8, and correctly announced as UTF-8, then the
    browser will (and probably should) send the data as UTF-8.

    But Explorer can be set to always use UTF-8 when sending form data (or
    URLs in general). Look around in your browser settings. May that is the
    problem.

    --
    Bertilo Wennergren <> <http://www.bertilow.com>
     
    Bertilo Wennergren, Nov 9, 2003
    #2
    1. Advertising

  3. Hans Meier

    Hans Meier Guest

    Changing the browser settings is not an acceptable solution.
    But maybe I can change the character set of the page using HTML tags.
    Do you know how to do that?

    > Hans Meier:
    >
    > > When I submit a form, Internet Explorer 6 encodes the form data á to

    %C3%A0
    > > in the URL. It should be %E1. What's wrong?

    >
    > > %C3%A0 seams to be the Unicode character of á, but á is also in the ANSI
    > > character set (%E1).

    >
    > It does indeed seem to be the Unicode, UTF-8, way to encode "á". If the
    > page itself is in UTF-8, and correctly announced as UTF-8, then the
    > browser will (and probably should) send the data as UTF-8.
    >
    > But Explorer can be set to always use UTF-8 when sending form data (or
    > URLs in general). Look around in your browser settings. May that is the
    > problem.
    >
    > --
    > Bertilo Wennergren <> <http://www.bertilow.com>
    >
     
    Hans Meier, Nov 9, 2003
    #3
  4. "Hans Meier" <> wrote:

    > Changing the browser settings is not an acceptable solution.
    > But maybe I can change the character set of the page using HTML tags.
    > Do you know how to do that?


    It seems that you don't know the basics of using character encodings on the
    Web (since you regard it primarily as an HTML issue), or even the basics of
    netiquette (since you use TOFU, Text Oben Fullquote Unten). I would
    recommend gaining basic understanding of such issues, see e.g.
    http://www.cs.tut.fi/~jkorpela/html/chars.html
    and then attacking the hard problem of character encodings for form data,
    see http://ppewww.ph.gla.ac.uk/~flavell/charset/form-i18n.html

    --
    Yucca, http://www.cs.tut.fi/~jkorpela/
    Pages about Web authoring: http://www.cs.tut.fi/~jkorpela/www.html
     
    Jukka K. Korpela, Nov 9, 2003
    #4
  5. Hans Meier:

    > Changing the browser settings is not an acceptable solution.


    In this case you might have to.

    > But maybe I can change the character set of the page using HTML tags.
    > Do you know how to do that?


    You should make the server announce the character encoding. It does that
    in the HTTP header that it sends to the browser _before it sends the
    actual page_.

    But in order to do that you either need to be able to configure the
    server yourself, of have the server administrator do it for you (or use
    PHP or something similar, where you can handle these things).

    If you really can't have the server do it correctly, you can as a last
    resort put the information in a "meta" element in the HTML code. That's
    a surrogate solution, but it usually works.

    In that case the code is this (it goes somewhere in the "head" section):

    <meta http-equiv="Content-Type"
    content="text/html; charset=iso-8859-1">

    Or, if you use XHTML, this:

    <meta http-equiv="Content-Type"
    content="text/html; charset=iso-8859-1" />

    That's for announcing Latin 1, the most commonly used encoding. If you
    do want to use Unicode instead, replace "iso-8859-1" with "UTF-8".

    But if the server also sends info about the encoding, and says something
    else than your "meta" element, then you have a problem. The browsers
    should obey what the server says, but many of them obey the "meta"
    element instead. And some just get very confused (sometimes). So do try
    to do it the right way: in the server.

    Actually, if you use XHTML, and if you want to use Latin 1, then you
    _must_ announce the encoding in the HTTP header (the server way), or
    else add some more funny code in the HTML (that might cause other problems).

    But, if Explorer is set to always use UTF-8 in URLs, this might not do
    the trick for you.

    It is a complicated issue.

    --
    Bertilo Wennergren <> <http://www.bertilow.com>
     
    Bertilo Wennergren, Nov 9, 2003
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Hardy Wang

    Encoding.Default and Encoding.UTF8

    Hardy Wang, Jun 8, 2004, in forum: ASP .Net
    Replies:
    5
    Views:
    18,931
    Jon Skeet [C# MVP]
    Jun 9, 2004
  2. Nelson R.

    Wrong encoding reading form fields

    Nelson R., Jan 6, 2005, in forum: ASP .Net
    Replies:
    3
    Views:
    711
    Nelson R.
    Jan 12, 2005
  3. John C.
    Replies:
    5
    Views:
    8,003
    John C.
    Feb 24, 2006
  4. Replies:
    1
    Views:
    23,442
    Real Gagnon
    Oct 8, 2004
  5. Replies:
    2
    Views:
    388
Loading...

Share This Page