Nov 10, 2009

Characters of HTML file served by Apache are showing wrongly

Problem
Characters of  HTML file served by Apache are showing wrongly. Some characters like spaces or characters  are shown like symbols.

Solution:
Change character set of  apache by editing httpd.conf file 
edit  /etc/httpd/conf/httpd.conf and  change the value for the variable AddDefaultCharset
ex :-
AddDefaultCharset en_US.iso88591

Restart apache after editing httpd.conf. (To restart apache run "service httpd restart")



Similarly
Default character set of a system will be defined in a system variable called "LANG"
check your system's  value with
"echo $LANG"
change it according to your requirement
example-
 export LANG=en_US.iso88591


To see the list of possible character set in your system run
$> localedef --list-archive 
 

To name a few ,
en_US.iso88591
en_US.iso885915
en_GB.iso88591
en_GB.iso885915



No comments:

Post a Comment