Jump to content

Recommended Posts

Posted (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

correctphpmyadmin.gif

incorrectwebpage.gif

thedanny.gif

Edited by Jackd
Posted

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.

Posted (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 by Jackd
More Info
Posted
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 shortly

file.txt

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 account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...