Re: PHP charset encoding
| From: | Rob Ellis | Date: | Tue, 30 Mar 2004 14:01:33 +0000 |
| Subject: | Re: PHP charset encoding | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-181815@lists.php.net to get a copy of this message | ||
On Tue, Mar 30, 2004 at 11:23:03AM +0300, nabil wrote:
> Hi all,
>
> I have problem storing the submitted data in the database in the right
> encoding.
> I need to use UTF-8
>
> I need to save the Arabic text in UTF-8 encoding.
>
> I have a problem with UTF-8 and windows-1256 conversion.
> I wish I can understand those things, coz encoding thing will take my hair
> off....
>
> When submitting a data from an HTML page and inserting them in MySQL:
> what encoding they will be ?
> is it the page encoding?
> the field size like VARCHAR 15 won't fit the same in both encoding for the
> same text. !!
> Is the font any relation with encoding?
> phpmyadmin doesn't support UTF-8 so dumping your data using it will screw it
> up.... is it a way to convert it inside the database...
>
> Explain to me please , or if you can tell me where to find my answers (not
> google)
>
if the page that the input form is on sets utf-8 as the content type,
then most (?) browsers will send utf-8. you can use a meta tag like:
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
utf-8 characters are 8 bit clean, so they can be stored and retrieved
in mysql 3.x ok, but proper utf-8 sorting etc. doesn't work. for many
purposes though it seems to be ok.
single characters in utf-8 encoding do look like multiple characters
as far as 8 bit text handling programs are concerned (so yes, 15 characters
in iso-8859-1 or ascii isn't the same length as 15 characters in utf-8).
fonts that support utf-8 are required for properly displaying utf-8,
and you have to specify utf-8 on the display page (either via a content-type
header or with content-type meta tag as above) to get the browser
to use the right fonts.
- rob