[ESW Wiki] Update of "geoChangingEncoding" by RichardIshida

Dear Wiki user,

You have subscribed to a wiki page or wiki category on "ESW Wiki" for change notification.

The following page has been changed by RichardIshida:
http://esw.w3.org/topic/geoChangingEncoding


------------------------------------------------------------------------------
  '''[http://www.w3.org/International/geo/2004/article-devt-process.html Status: Initial Draft]''' 
  ie. please focus on technical content, rather than wordsmithing at this stage.
  
+ See the [[http://www.w3.org/International/geo/ GEO home page]].
+ 
  Author: Richard Ishida
  
+ = Changing page encoding =
  
+ '''How do I change the encoding of my (X)HTML pages to UTF-8?'''
+ 
+ == Background ==
+ 
+ So you've heard that [[http://www.w3.org/International/tutorials/tutorial-char-enc/en/all.html#Slide0120 it's useful]] to encode your pages in UTF-8 rather than a legacy encoding such as Windows 1252 or ISO 8859-1, and you've heard that [[http://www.w3.org/International/questions/qa-who-uses-unicode others are doing it]], but you're not sure how to do it.  This page will help.
+ 
+ == Answer ==
+ 
+ Follow the links to get detailed information about each step.
+ 
+ === Step 1: Save the data as UTF-8 ===
+ 
+ It is not sufficient to just change the declarations inside your pages to say that the page is encoded in UTF-8.  You must ensure that your data is actually encoded, ie. saved, in UTF-8. If you are working with 'flat files' then you should [[http://www.w3.org/International/questions/qa-setting-encoding-in-applications use your editor to save the file in UTF-8]] rather than the encoding you were using. If you are building files from scripts and databases, you should ensure that the data is converted if necessary and that the correct parameters are set in your scripting environment.
+ 
+ Note that you may have to ensure that the data [[http://www.w3.org/International/questions/qa-utf8-bom does not include a UTF-8 signature]], or byte-order mark (BOM).
+ 
+ === Step 2: Declare the encoding in your page ===
+ 
+ You should [[http://www.w3.org/International/tutorials/tutorial-char-enc/en/all.html#Slide0240 change the character encoding declaration]] in your page (or add one if you don't already declare it).
+ 
+ === Step 3: Ensure that your server does the right thing ===
+ 
+ Although your data is in UTF-8 and you have declared it in the page, your server may still be serving the page with an HTTP header that says it is something else.  The declaration in the HTTP header will override information inside the page.
+ 
+ To address this you need to [[http://www.w3.org/International/questions/qa-headers-charset check whether this is actually a problem or not]], and then, if it is, [[http://www.w3.org/International/O-HTTP-charset take steps to rectify it]].  
+ 
+ Server admin privileges are needed to change the encoding sent in the HTTP header, though you may be able to do so yourself even if you are serving files via an ISP. Consult your server admin person.  See the explanation of [[http://www.w3.org/International/questions/qa-htaccess-charset one way to do this for an Apache server]].
+ 

Received on Friday, 8 July 2005 16:07:00 UTC