I simply need to remove this line in header
of every my drupal pages
<html xmlns="http://www.w3.org/1999/xhtml" lang="vi" xml:lang="vi">
this line made me crazy with vietnamese language.
I just want to use only ".


Thank you very much for hint.

[edit -sepeck: added <code> tags]


nofue’s picture


Changes to the page per se are best applied to



-- form follows function


-- form follows function

pembeci’s picture

Which line are you talking about? If it is the char-set meta header line then UTF-8 (the default in Drupal) should be the best choice and changing it may cause a lot of problems. Can you explain the problem you are experiencing? In any case, you can check page.tpl.php in your theme directory about the headers.

winman1’s picture

hi again,

i think i have problem with xmlns tag in header:

xmlns="http://www.w3.org/1999/xhtml" lang="<?php print $language ?>" xml:lang="<?php print $language ?>">

i removed "xmlns", and still stay with UTF-8 but the problem still remain!

It's so strange, yesterday was broken day as I lost my niece :(, after 20h not watching website,
i saw all with vietnamese unicode encoding pages look strange!

Next strange thing: when I post a page, content with vietnamese encoding in "Edit" page
looks correctly in "priview" mode: http://vimkea.com/tiengviet.jpg

but after i submit, the page looks strange too.

Is there any problem with style?
Maybe a hacker problem? I use drupal-4.7.2

Thank you very much.

pembeci’s picture

The database tables should be created by default with UTF-8 encoding but just to be sure you may want to check those. There are a lot of Drupal sites which use an non-English language and they work fine. Be sure also you are not copy pasting text from other sites which may use another encoding. Other than these, I don't know what else to suggest. Does your site begin behaving like this after working fine or the problem was there from the start? You can ask also other Drupal users from Vietnam.

winman1’s picture

a friend of mine who runs one big site in Vietname told me
the problem is at hosting company. And really, the hosting
company changes php!

when I preview post, data is not stored at server,
so I see vietnamese unicode characters correctly
but after submit, data is stored at server ... that is the problem

But how to solve this problem, try to advice my hosting company ...

some strange things I see in my cPanel:

at "Show MySQL system variables " I see:

character set system utf8
character sets dir /usr/share/mysql/charsets/
collation connection utf8_unicode_ci
(Global value) latin1_swedish_ci
collation database latin1_swedish_ci
collation server latin1_swedish_ci

why these "latin1_swedish_ci" here?

Anyone has experiences with these setting at hosting company?:

collation = utf8_general_ci
"SET CHARACTER SET utf8" and "SET SESSION character_set_server=utf8"?
AddDefaultCharset UTF-8 collation = utf8_general_ci
"SET CHARACTER SET utf8" and "SET SESSION character_set_server=utf8"?
AddDefaultCharset UTF-8

Thx you.

winman1’s picture

after 2 days searching I think i found the solution:

We need to change collation of db/table and all varchar or longtext to
( as mysql server default value for account at shared server
is set to latin1_swedish_ci )

I found the code for change collation on all mysql tables

global $db_url;
$database = parse_url($db_url);
$result = db_query('show tables');
while($tables = db_fetch_array($result)) {
  foreach ($tables as $key => $value) {
    db_queryd("ALTER TABLE %s COLLATE utf8_general_ci",$value);

The problem is i am even less than php-mysql newbie!
I need a code from you: can we go through fields of table and
change it's collation to utf8_general_ci?

Could anyone improve above code in order we can change
collation of varchar or longtext to utf8_general_ci?

Thank you very very much.

pembeci’s picture


see the comment at the bottom and apply that query instead of the one above. This is for MySQL 5.0. Take a dump of the database before you attempt such things.