Problems with Apache and special characters

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • tarmstrong@gmail.com

    #1

    Problems with Apache and special characters

    Hi.

    Running Apache/2.0.52 on Linux, I've got problems with special
    characters
    (Spanish tildes) on my pages. I can see them correctly on my machine
    (España), but
    not on my web server (España).

    My test page is:
    -------------------------
    <html>
    <h1>España</h1>
    </html>
    -------------------------

    Within my 'httpd.conf' I set:
    -------------------
    AddDefaultChars et ISO-8859-1
    -------------------

    I don't know wether it's a problem of my webpages or of my webserver.
    Any suggestion? Thank you very much.

  • Michael Fesser

    #2
    Re: Problems with Apache and special characters

    .oO(tarmstrong@ gmail.com)
    [color=blue]
    >Running Apache/2.0.52 on Linux, I've got problems with special
    >characters
    >(Spanish tildes) on my pages. I can see them correctly on my machine
    >(España), but
    >not on my web server (España).[/color]

    Post an URL.

    Micha

    Comment

    • Pedro Graca

      #3
      Re: Problems with Apache and special characters

      tarmstrong@gmai l.com wrote:[color=blue]
      > Running Apache/2.0.52 on Linux, I've got problems with special
      > characters (Spanish tildes) on my pages. I can see them
      > correctly on my machine (España), but
      > not on my web server (España).[/color]

      Looks like some sort of Unicode.
      [color=blue]
      > My test page is:
      > -------------------------
      > <html>
      > <h1>España</h1>
      > </html>
      > -------------------------[/color]

      Are you sure your test page isn't encoded in UTF-8 or Unicode or
      whatever (something different than ISO-8859-1)?
      [color=blue]
      > Within my 'httpd.conf' I set:
      > -------------------
      > AddDefaultChars et ISO-8859-1
      > -------------------
      >
      > I don't know wether it's a problem of my webpages or of my webserver.[/color]

      It's a problem of both and neither: they're not in synch!
      [color=blue]
      > Any suggestion? Thank you very much.[/color]

      Try:

      <h1>Espa&ntilde ;a</h1>

      and the encodings for your server and pages no longer matter :-)

      --
      Mail to my "From:" address is readable by all at http://www.dodgeit.com/
      == ** ## !! ------------------------------------------------ !! ## ** ==
      TEXT-ONLY mail to the whole "Reply-To:" address ("My Name" <my@address>)
      may bypass my spam filter. If it does, I may reply from another address!

      Comment

      • Michael Fesser

        #4
        Re: Problems with Apache and special characters

        .oO(Pedro Graca)
        [color=blue]
        >Try:
        >
        > <h1>Espa&ntilde ;a</h1>
        >
        >and the encodings for your server and pages no longer matter :-)[/color]

        I would rather fix the encoding issue instead of using entities.

        Micha

        Comment

        • Dani CS

          #5
          Re: Problems with Apache and special characters

          tarmstrong@gmai l.com wrote:[color=blue]
          > Hi.
          >
          > Running Apache/2.0.52 on Linux, I've got problems with special
          > characters
          > (Spanish tildes) on my pages. I can see them correctly on my machine
          > (España), but
          > not on my web server (España).
          >
          > My test page is:
          > -------------------------
          > <html>
          > <h1>España</h1>
          > </html>
          > -------------------------
          >
          > Within my 'httpd.conf' I set:
          > -------------------
          > AddDefaultChars et ISO-8859-1
          > -------------------[/color]

          Try using UTF-8 instead. Your file is being served as ISO-8859-1 but
          it's really encoded with UTF-8 (you get ñ when you try to decode a
          UTF-8 'ñ' with the ISO-8859-1 decoder).
          [color=blue]
          >
          > I don't know wether it's a problem of my webpages or of my webserver.
          > Any suggestion? Thank you very much.[/color]

          You can else:
          -tell your text editor to save your files using ISO-8859-1, or
          -place the appropiate <meta> tag in your files so that the server and/or
          browser know how to decode the file.

          Comment

          • John Dunlop

            #6
            Re: Problems with Apache and special characters

            Dani CS wrote:
            [color=blue]
            > -place the appropiate <meta> tag in your files[/color]

            Fine; but that's no substitute for HTTP headers. Even
            though a server might form HTTP headers from http-equivs, I
            see no reason not to remove any doubt and instruct the
            server yourself.

            --
            Jock

            Comment

            • Dani CS

              #7
              Re: Problems with Apache and special characters

              John Dunlop wrote:[color=blue]
              > Dani CS wrote:
              >
              >[color=green]
              >>-place the appropiate <meta> tag in your files[/color]
              >
              >
              > Fine; but that's no substitute for HTTP headers. Even
              > though a server might form HTTP headers from http-equivs, I
              > see no reason not to remove any doubt and instruct the
              > server yourself.
              >[/color]

              Instructing the server is easy when all the documents use the same
              encoding. But this situation is far from real in many environments (eg.
              my own machine -- Kate on Linux insists on UTF-8, but Crimson Editor on
              Windows is stuck with ISO-8859-1).

              However, there's a "per-file" way to instruct the server on encodings,
              apart from <meta> tags:

              <?php header("Content-Tye: text/html; charset=..."); ?>

              This should work fine, but should be placed at the begining of those
              files that don't use the default encoding assumed by the server.


              Moreover, I believe that some programs exist that automagically guess
              the encoding of a file; such a program could be executed for each file
              served, and its output prepended in a Content-Type header. Downsides
              are: significant performance hit, and possible wrong guesses that drive
              the cliente mad.

              Un saludo,
              Dani.

              Comment

              • Michael Fesser

                #8
                Re: Problems with Apache and special characters

                .oO(Dani CS)
                [color=blue]
                >Instructing the server is easy when all the documents use the same
                >encoding.[/color]

                I consider that as it should be.
                [color=blue]
                >But this situation is far from real in many environments (eg.
                >my own machine -- Kate on Linux insists on UTF-8, but Crimson Editor on
                >Windows is stuck with ISO-8859-1).[/color]

                I would decide for one encoding and then only use software that's
                capable of handling it.

                Micha

                Comment

                • Michael Fesser

                  #9
                  Re: Problems with Apache and special characters

                  .oO(John Dunlop)
                  [color=blue]
                  >Dani CS wrote:
                  >[color=green]
                  >> -place the appropiate <meta> tag in your files[/color]
                  >
                  >Fine; but that's no substitute for HTTP headers. Even
                  >though a server might form HTTP headers from http-equivs, I
                  >see no reason not to remove any doubt and instruct the
                  >server yourself.[/color]

                  The whole situation with the meta-charset-thing is rather paradox: The
                  information about the used encoding is stored inside the document, so
                  the UA has to decode the document first to know how to decode it ...

                  Stupid.

                  Micha

                  Comment

                  • Tony Marston

                    #10
                    Re: Problems with Apache and special characters


                    "Michael Fesser" <netizen@gmx.ne t> wrote in message
                    news:hp7vr0d2p1 gpaem0uqu0theup l7cd90083@4ax.c om...[color=blue]
                    > .oO(John Dunlop)
                    >[color=green]
                    >>Dani CS wrote:
                    >>[color=darkred]
                    >>> -place the appropiate <meta> tag in your files[/color]
                    >>
                    >>Fine; but that's no substitute for HTTP headers. Even
                    >>though a server might form HTTP headers from http-equivs, I
                    >>see no reason not to remove any doubt and instruct the
                    >>server yourself.[/color]
                    >
                    > The whole situation with the meta-charset-thing is rather paradox: The
                    > information about the used encoding is stored inside the document, so
                    > the UA has to decode the document first to know how to decode it ...
                    >
                    > Stupid.
                    >
                    > Micha[/color]

                    Not if you supply that information on an HTTP header, as in:-

                    header('content-type:text/html; charset=UTF-8');

                    --
                    Tony Marston
                    This is Tony Marston's web site, containing personal information plus pages devoted to the Uniface 4GL development language, XML and XSL, PHP and MySQL, and a bit of COBOL





                    Comment

                    • John Dunlop

                      #11
                      Re: Problems with Apache and special characters

                      Michael Fesser wrote:
                      [color=blue]
                      > The whole situation with the meta-charset-thing is rather paradox: The
                      > information about the used encoding is stored inside the document, so
                      > the UA has to decode the document first to know how to decode it ...[/color]

                      The HTML4.01 spec says:

                      | The META declaration must only be used when the character
                      | encoding is organized such that ASCII-valued bytes stand
                      | for ASCII characters (at least until the META element is
                      | parsed). META declarations should appear as early as
                      | possible in the HEAD element.



                      See also news:c5jjd9$2el hn$1@ID-114100.news.uni-berlin.de .

                      (Sorry, I don't know how best to refer to threads in groups-
                      beta (spit). That's the message-id of the first article.)

                      --
                      Jock

                      Comment

                      • Michael Fesser

                        #12
                        Re: Problems with Apache and special characters

                        .oO(Tony Marston)
                        [color=blue]
                        >Not if you supply that information on an HTTP header, as in:-
                        >
                        >header('conten t-type:text/html; charset=UTF-8');[/color]

                        That's how it's supposed to be. If I do it correctly in the server's
                        response header I don't need that meta-thing anymore.

                        Micha

                        Comment

                        • Michael Fesser

                          #13
                          Re: Problems with Apache and special characters

                          .oO(John Dunlop)
                          [color=blue]
                          >See also news:c5jjd9$2el hn$1@ID-114100.news.uni-berlin.de .
                          >
                          >(Sorry, I don't know how best to refer to threads in groups-
                          >beta (spit). That's the message-id of the first article.)[/color]

                          Then use the "old" Google Groups. ;)



                          Interesting thread BTW.

                          Micha

                          Comment

                          Working...