View Full Version : Charset and fq's server for site in multi language
Hi,
i'm going to host a site on fq's shared plans, and this small site will be translated in: english, german, french, spanish, portugese and japanese.
Is the utf-8 compatible with all these languages ?
Are the mysql on fq's server set to this character encoding ?
hobbes
11-27-2007, 07:27 PM
UTF-8 will handle most languages fine.
You will want to ensure that your account is setup for MySQL 5. When creating the database/tables/field, just be sure to set them to utf8 encoding and utf8_unicode_ci or utf8_general_ci collation. Note that MySQL uses utf8 whereas the standard is utf-8. Also issue the following SQL command after you connect with the database:SET NAMES 'utf8'
Don't forget to properly set your XHTML headers to specify UTF-8. And if you're using PHP, be careful with the default string manipulation functions (e.g., strlen, htmlentities).
Don't forget to properly set your XHTML headers to specify UTF-8.
Thanks for your answer. Is this just done with the charset meta tag ?
hobbes
11-28-2007, 08:55 AM
Make sure your meta tag appears first in the <head> section so everything afterwards is properly set as well.
If you have an XHTML doc, I would also add the following as the first line:<?xml version="1.0" encoding="utf-8"?>
And so you're double-secret sure that everything is set properly, you should also issue the following HTTP header: Content-Type: text/xml, charset=utf-8And add the following attribute to your <form> tags:accept-charset="utf-8"
Here's some sample PHP:<?php
header('Content-Type: text/html; charset=utf-8');
print '<?xml version="1.0" encoding="utf-8"?>';
mysql_connect(...);
mysql_query("SET NAMES 'utf8'");
mysql_select_db(...);
?>
<!DOCTYPE ...>
<html ...>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
...
</head>
<body>
<form ... accept-charset="utf-8">
...
</form>
</body>
</html>
vBulletin® v3.6.8, Copyright ©2000-2012, Jelsoft Enterprises Ltd.