Weiss Posted August 29, 2017 Share Posted August 29, 2017 Hey. Im not quite sure if the question should be here or in php topic. I have SQL database with some coloums in hebrew. its set to hebrew_bin (refering to the collation coloum in the structure of the DB). well, its shoes up fine when i look at it thru phpmyadmin but when i write a php script to retrieve the data i get lots of "???????". i must be doing something wrong here!, please help thanks very much helpers! Link to comment Share on other sites More sharing options...
justsomeguy Posted August 29, 2017 Share Posted August 29, 2017 I haven't used collation other than Unicode, but make sure that all points along the way are using the same thing. The PHP code should send a header telling the browser what the character set is, the page should have a meta tag saying the same thing, and the text that you actually output from the database needs to be in the character set that you say it's going to be in. Link to comment Share on other sites More sharing options...
Weiss Posted August 30, 2017 Author Share Posted August 30, 2017 thanks for your help. though im still lost my DB and table are set to be utf8_general_ci. my php script start with these lines: <?php $dbc = mysqli_connect(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME); mysqli_select_db("logitech",$dbc); //logitech is the name of the DB. mysqli_query("SET character_set_client=utf8"); mysqli_query("SET character_set_connection=utf8"); mysqli_query("SET character_set_databse=utf8"); mysqli_query("SET character_set_results=utf8"); mysqli_query("SET character_set_server=utf8"); ... still when i run a select query, whenever i select colums with numbers/english letters it works, when i try to retrieve info from coloum included hebrew it write lots of "?????" any idea? Link to comment Share on other sites More sharing options...
justsomeguy Posted August 30, 2017 Share Posted August 30, 2017 Well, my answer is still the same thing. Make sure everything, not just the database connection, is using the same encoding. I've never used that many statements to set MySQL to UTF8, you can do it with "SET names utf8". There's also a mysqli function specifically for that: http://php.net/manual/en/mysqli.set-charset.php Other than the database, make sure that your page is telling the browser that it's UTF8, that it's part of the response headers, and that the text actually is UTF8. 1 Link to comment Share on other sites More sharing options...
Weiss Posted August 30, 2017 Author Share Posted August 30, 2017 solved it! thanks very much again! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now