Jackd Posted February 6, 2008 Posted February 6, 2008 (edited) Ive got a table setup in MySQL that will hold some textdata one of the columns is setup as LONGTEXT. And the collation set to utf8_unicode. Im trying to insert characters such as the ones on the screenshot below, it displays fine in phpmyadmin but on a webpage where it pulls the text from the db the characters are displayed as question marks. The screenshot first is what it shows as in phpmyadmin which is correct, the second screenshot is the one from my page which is incorrect, and the third screenshot is the original P.S. Excuse the random piece of text, i just picked it because it had lots of random characters in Thanks Jack Dunn Edited February 6, 2008 by Jackd
Jackd Posted February 6, 2008 Author Posted February 6, 2008 I dont know, whats that mean, and how do i do it? Jack
localzuk Posted February 6, 2008 Posted February 6, 2008 You'd have to send a header for the php document such as header ('Content-type: text/html; charset=utf-8'); But obviously catered to your particular needs in terms of the content type. Note, header function calls have to be the first lines in your php code, so straight after the < ?php call.
Jackd Posted February 6, 2008 Author Posted February 6, 2008 Nope, with that it still doesnt seem to work still displaying the same as before Jack
localzuk Posted February 7, 2008 Posted February 7, 2008 If you try and export to a text file, what do you get displayed?
Jackd Posted February 7, 2008 Author Posted February 7, 2008 (edited) If you try and export to a text file, what do you get displayed? Im sorry, but what do you mean by that, in phpmyadmin? How would i go around doing that? Ive tried exporting the table to Excel and it displays fine in there, and ive also exported it to standard SQL and the characters display fine in notepad Jack Edited February 7, 2008 by Jackd More Info
localzuk Posted February 7, 2008 Posted February 7, 2008 No, instead of trying to output to a web page, can you isolate the calls in php to mysql and get it to output to a text file instead of displaying in an html page. ie. http://www.tizag.com/phpT/filewrite.php
Jona Posted February 7, 2008 Posted February 7, 2008 This is more of a work around than a solution but you could encode it to base64 http://uk2.php.net/manual/en/function.base64-encode.php and then decode it when you pull it out of the database http://uk2.php.net/manual/en/function.base64-decode.php 1
Jackd Posted February 7, 2008 Author Posted February 7, 2008 No, instead of trying to output to a web page, can you isolate the calls in php to mysql and get it to output to a text file instead of displaying in an html page. ie. http://www.tizag.com/phpT/filewrite.php Done that and its still ?'s, ive attached the outputted file below This is more of a work around than a solution but you could encode it to base64 http://uk2.php.net/manual/en/function.base64-encode.php and then decode it when you pull it out of the database http://uk2.php.net/manual/en/function.base64-decode.php I'll have a look at this now and get back with the results shortlyfile.txt
Jackd Posted February 7, 2008 Author Posted February 7, 2008 Thanks Jona, base64 encoding and decoding works fine! Jack
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