Caracter set of mysql and php
Moderator: General Moderators
-
bfis108137
- Forum Newbie
- Posts: 3
- Joined: Wed Feb 07, 2007 10:39 am
Caracter set of mysql and php
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]
- feyd
- Neighborhood Spidermoddy
- Posts: 31559
- Joined: Mon Mar 29, 2004 3:24 pm
- Location: Bothell, Washington, USA
You can turn binary streams into harmless nonsense using base64_encode().
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.
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.
-
bfis108137
- Forum Newbie
- Posts: 3
- Joined: Wed Feb 07, 2007 10:39 am
base64_encode() and mobile phones
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?
Any suggestions?
- Ambush Commander
- DevNet Master
- Posts: 3698
- Joined: Mon Oct 25, 2004 9:29 pm
- Location: New Jersey, US
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).