I’m having some issues with some text I’m copy-pasting into my database via phpMyAdmin. Sometimes when I have special characters such as fancy quotes, m-dashes, etc., the text will not output on the page via PHP. I tried various functions such as htmlspecialchars() but haven’t found the right combination to make this work in all scenarios. I don’t understand character sets very well. Can someone please help me figure out how to output this text when I copy straight into phpMyAdmin? Thanks!
Does your column (or table) use a character set that allows those caracters? Because most of the time, this is the problem
No idea. That’s what I need you for.
Well, you have to possible problems. The character set and collation used in your table and in this particular field and the character set used in the web page that phpAdministration uses.
To know which character set the web page uses, view the page source and check the meta tag “character set”
To know which character set the table and the field are using , look it up in phpAdministration. I can’t remember where now… and I can’t look it up here. But wherever you see the structure of the table
Those two need to match, ideally
The website is UTF-8. I coded it by hand.
The collation field for the tables is utf8_unicode_ci.
There really is not a ton of substance in the tables yet, if that makes any difference. I have two tables, both of which are almost entirely letters and numbers. I put in a few HTML entities. There are maybe 25 cells with the problematic characters: quotation marks and dashes, basically.
And your text editor is UTF-8 as well?
Maybe it would be worth your time to write a small script using iconv?
Yes, I’m using TextWrangler. UTF-8.
I would probably rather copy-paste my entire 2 tables into 2 new tables than to write a script for the conversion. Is there any other way to do this?
If you wanted to do it manually using only phpMyAdmin, could you not
copy - fix - UPDPATE ?
a bit more tedious, but for a one-off for only a couple dozen fields it shouldn’t be all that bad.
If you think it might be an ongoing problem however, you should look into a way that fixes the cause or is at least more manageable.
How can I create a new table with the right character set? I see that I can set the collation, but utf8 isn’t any of the options. There is utf8_variousthingshere
This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.