How to change Default Charset in Apache ?

Discussion in 'Server Operation' started by cooljai, May 19, 2008.

  1. cooljai

    cooljai New Member

    Hi,
    I'm on CentOS 5 and like to change default charset of 'ISO-8859-1' to 'UTF-8' in my Apache 2.2 Server.
    Added following line:
    Code:
    AddDefaultCharset UTF-8
    Restart Apache and checked default server page, it says good UTF-8. But when running perl scripts:
    Code:
    http://serverip/cgi-bin/myscript.pl
    Checking from browser (Firefox, View->Character Encoding) says charset is "Western ISO-8859-1" instead of expected UTF-8 :( .

    Do I need to change any other setting in Apache in order to force UTF-8 for all contents? Kindly suggest.

    Thanks
     
  2. mccharlet

    mccharlet Member HowtoForge Supporter

    This file for debian /etc/apache2/apache2.conf
     
  3. cooljai

    cooljai New Member

    Thanks for reply but as I already mentioned, I'm on CentOS 5 ;)

    Just wanna hint, is there anything else, I need to update in Apache? :rolleyes:
     
  4. falko

    falko Super Moderator ISPConfig Developer

    Does the Perl script maybe set its own charset?
     
  5. cooljai

    cooljai New Member

    Might be, I have instructed programmers to have a look in it. Meanwhile, I just create a very simple perl script:
    Code:
    #!/usr/bin/perl
    print "Content-Type: text/html\n\n";
    print "Web Server running fine.";
    and checked. Browser reports UTF-8.
    Another annoying fact is that If I try to explore a directory:
    Code:
    http://serverip/cgi-bin/
    Its showing 403 Forbidden and reporting chatset as "Western ISO-8859-1".

    Do directories also have something to do with Charset?
     
  6. falko

    falko Super Moderator ISPConfig Developer

    That page is coming from Apache.
    Do you see any directives in your Apache configuration that are related to iso-8859-1?
     
  7. cooljai

    cooljai New Member

    Regarding Apache configurations, I didnt specified any other Charset in my httpd.conf. About the 403 page, I found it in /var/www/error/HTTP_FORBIDDEN.html.var and updated UTF-8 in it everywhere (including html file in include directory). Still, browser is showing "Western ISO-8859-1" charset.. :(

    any further clue? :confused:
     
  8. falko

    falko Super Moderator ISPConfig Developer

    Unfortunately not... :(
     

Share This Page