[pmwiki-users] Translation [was pmwiki-users] i18n and iso-8859-13

Joachim Durchholz jo at durchholz.org
Thu Apr 7 04:41:31 CDT 2005


Algis Kabaila wrote:
> Also, would you mind if I ask a 'non-wiki' question - how to correctly specify 
> utf-8 encoding in a web page?  (I have used meta tags under the wrong 
> impression that this was a standard way of doing it. Currently my **wrong** 
> header looks like this:
 >
>   <meta content="text/html; charset=utf-8" http-equiv="content-type">  ).

This looks alright to me.

Order shouldn't matter, but maybe it does anyway, so it might be better 
to use the standard order:

   <meta http-equiv="content-type" content="text/html; charset=utf-8">

The problem is probably elsewhere. Things that I can think of:

1) PHP isn't generating UTF-8 but something else. (Try intercepting the 
HTML output and viewing it in a hex dump utility to verify that. If the 
Lithuanian-specific characters are two-byte or three-byte character 
sequences, it's indeed UTF. Another symptom would be a "byte order mark" 
at the beginning of the UTF-8-encoded text stream, which two bytes that 
are either FF FE or FE FF; I'm not sure whether it's used in HTML 
though, nor where exactly it would go.)

2) The doctype line says it's XHTML, but the tag as given isn't, it must 
end with /> like this:

   <meta http-equiv="content-type" content="text/html; charset=utf-8" />

3) The server sends a HTTP header that also specifies a character set 
(one that isn't the same as the character set in the meta tag). I don't 
which of the two takes precedence. If you have an Apache configured for 
taking character set information from .htaccess files, or have access to 
the web server's configuration, you can say

   AddCharset UTF-8 .php

to specify a default character set.

4) PmWiki is explicitly setting the HTTP header (PHP allows it to do 
that). If that's the case, it will have code like

   header('Content-Type: text/html; charset=ISO-8859-1');

somewhere in it (letter case and syntactic variations possible).


Regards,
Jo



More information about the pmwiki-users mailing list