Page 1 of 1
Caracter set of mysql and php
Posted: Wed Feb 07, 2007 10:56 am
by bfis108137
My host has mysql 4.0.16, and they said that this version of mysql doesn't support Hebrew letters. First of all, is this true. Secondly, if so, is there a way maybe I could have php turn the Hebrew characters (since php does recognize the Hebrew) into recognizable charcters for mysql to put into the database and then turn them back into Hebrew characters when pulling them out. Any advice on this matter would be appreciated even if you don't know hebrew such as the way I would go about this and the php functions I might use. My php version is 4.4.1[/syntax]
Posted: Wed Feb 07, 2007 1:44 pm
by feyd
You can turn binary streams into harmless nonsense using
base64_encode().
Posted: Wed Feb 07, 2007 1:52 pm
by Mordred
I don't have a 4.0 installation around, so I'm speaking from memory, but it does support UTF-8. What it doesn't support is the SET NAMES and SET CHARACTER SET commands, so your hope is that your hosting's my.ini says the default connection character set is UTF-8. For a test, write a small script that inserts and retrieves a hebrew string. Make sure the encoding of the .php file is set to UTF-8, but without BOM markers - if you're not sure how to do that with your particular editor, download Scite and use File->Encoding->UTF-8 Cookie. Make sure that the html output is in UTF-8 by using a header() call or a META http-equiv tag, or just switch it in your browser.
I'm not sure if the connection setting can be set in another way, ask your hosting for cooperation and threaten them you'll switch to another host. As a last resort you can do so, and pick one that supports latest stable versions of PHP and MySQL.
base64_encode() and mobile phones
Posted: Sat Feb 10, 2007 1:50 pm
by bfis108137
I tried using base64_encode() and it works great except that it doesn't work on my mobile phone. I see in the html code it is actually outputting codes instead of Hebrew letters which apparently my browser understands but my phone doesn't. And example of what it puts out is לשכנע
Any suggestions?
Posted: Sat Feb 10, 2007 3:00 pm
by feyd
Many mobile phones have extremely poor implementations of browsers. It's quite possible your phone does not support UTF-8 encoding. Check with its manual and/or your phone's manufacturer to find out the details of what is supported.
Posted: Sat Feb 10, 2007 3:42 pm
by Ambush Commander
If it doesn't support UTF-8, you could html-entityize your HTML willy-nilly... the convertToASCIIDumbLossless() in
Encoder might help you (none of the rest of the class is needed).