LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 10-20-2008, 01:10 PM   #1
MheAd
Member
 
Registered: Jun 2007
Distribution: Ubuntu 14.04
Posts: 186

Rep: Reputation: 36
Directive in Apache for autoswitching of charset encoding.


I'm building a custom httpd.conf file, meaning "from the scratch" and I don't want to have unnecessary stuff activated. This is also a good learning experience, to know what you exactly need for certain things.
I've been trying to figure out this thing whole day by looking through Apache documentation without getting anywhere. Of course, there are no problems with this if one uses default httpd.conf file (shipped with Fedora 8) because there everything needed is added.

Here is the thing...
If I for instance create a simple file, with no MIME-stuff, no formatting whatsover, with Swedish character, using vim, and save it as html file it will be identified as UTF-8 document by FireFox, and it will switch automatically to the proper encoding and the characters will be shown properly - this is when I use the default Apache configuration. If I use my own (as I mentioned, don't really know which directives are needed so I obviously don't have them added) - the characters are shown in ugly way and my FireFox remains set to the default ISO-8859-1, so I need to manually switch to UTF-8 to get the proper characters.

I first thought it had to do with combination of AddLanguage sv sv. stuff but after closer research, from what I understood, it only concernes html files that do content mime-headers. I was experimenting with AddDefaultCharacter and different kinds of things - no use. I also thought negotiation module had something to do with it - activated it - no use.

So basically, I need to figure out what directives I need to put in httpd.conf that will notify my browser to switch to correct encoding. I hope I've made myself clear and you guys can help me out.

Here is how my Apache conf looks like.

Code:
Listen 80
User apache
Group apache
ServerRoot /etc/httpd
Options +FollowSymlinks 

Include conf.d/php.conf

LoadModule      mime_module             modules/mod_mime.so
TypesConfig /etc/mime.types

LoadModule      dir_module              modules/mod_dir.so
DirectoryIndex index.html index.htm

LoadModule      autoindex_module        modules/mod_autoindex.so

Options +Indexes
IndexOptions FancyIndexing ScanHTMLTitles FoldersFirst SuppressSize DescriptionWidth=*

HeaderName HEADER.html

IndexIgnore = "*~" 

LoadModule      alias_module    modules/mod_alias.so
Alias   /icons/ /var/www/icons/
 
AddIconByType /icons/layout.gif text/html
AddIconByType /icons/text.gif text/plain
AddIconByType /icons/generic.gif text/*
AddIconByType /icons/image2.gif image/*
AddIconByType /icons/sound1.gif audio/*
AddIconByType /icons/movie.gif video/*
AddIconByType /icons/ps.gif application/postscript
AddIconByType /icons/pdf.gif application/pdf

AddIcon /icons/dir.gif  "^^DIRECTORY^^"
AddIcon /icons/back.gif ".."
 
DefaultIcon /icons/ball.gray.gif

AddAltByType "HTML file" text/html
AddAltByType "Plain text" text/plain
AddAltByType "Text" text/*
AddAltByType "Static image" image/*
AddAltByType "Audio" audio/*
AddAltByType "Video" video/*
AddAltByType "PostScript" application/postscript
AddAltByType "PDF" application/pdf

AddAlt  "Directory" "^^DIRECTORY^^"
AddAlt  "Go Back" ".."

LoadModule log_config_module modules/mod_log_config.so

LogFormat "%h %l %u %t \"%r\" %>s %b" clf 

ErrorLog logs/error_log

LogLevel info
 
HostNameLookups off

LoadModule authz_host_module modules/mod_authz_host.so

LoadModule auth_basic_module modules/mod_auth_basic.so
LoadModule authn_file_module modules/mod_authn_file.so
LoadModule authz_user_module modules/mod_authz_user.so
LoadModule authz_groupfile_module modules/mod_authz_groupfile.so
LoadModule auth_digest_module modules/mod_auth_digest.so

NameVirtualHost * 
<snip> (Virutal hosts left out in this post - I don't add anything special there except for Document root).

Thanks in advance!
M.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Apache RedirectMatch Directive sir-lancealot Linux - Server 1 01-24-2008 04:14 AM
Apache - Alias directive Sapient Linux - Software 3 01-24-2006 07:57 AM
apache User directive merchtemeagle Linux - Software 2 03-07-2005 03:42 PM
Apache Directive sopiaz57 Linux - Security 2 12-09-2003 01:32 PM
Apache2: Charset and Encoding Problems sarmadys Linux - General 0 11-17-2002 12:11 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 06:13 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration