TrianglePHP Message Board › Converting fields to canonical HTML

Converting fields to canonical HTML

Nancy S.
nes49
Raleigh, NC
Post #: 6
I'm moving a MySQL database from one server to another, and the two systems aren't handling special characters embedded in text/html fields in the same way. [The application is WordPress.]

Both databases are set to UTF-8 (as far as I can tell) and the web page that shows the symptoms has charset=UTF-8

System 1 shows:
or http://bit.ly/9zFIfo...­


System 2 shows:
or http://bit.ly/99pnU4...­

I realize that these characters probably originated in a "paste from Word" that wasn't handled correctly and that there are plugins that claim to clean things up when saving the content or displaying it. However, I'm at a point where I'd like to go through the fields that store HTML and just replace the characters with HTML entities, and I can't seem to get a good "cleanup the code" program working.

Does anyone have any pointers/examples? or other things to look at to address this issue?

Thanks!
A former member
Post #: 1
Hey Nancy, you may want to try to escape the string before moving it from one db to another.

Would that work for you?

Joe.
Nancy S.
nes49
Raleigh, NC
Post #: 7
Joe -

Sorry, but I don't understand what that means.

I'm exporting/importing the entire database and would think the appropriate escaping would be handled there. I suppose I could modify some of the fields before doing the import -- but the question is what, precisely, needs to be escaped. Any code samples? Or are there options in phpMyAdmin that I should change from the defaults?

Thx!

-Nancy

Nancy S.
nes49
Raleigh, NC
Post #: 8
Dreamhost support suggested adding a line to the wp-config.php file --

define('DB_CHARSET', 'utf8');

I thought I'd checked that, but I guess not ... It does seem to help.

Anyway I'd still like a way to

== read a field containing text to be displayed in a browser
== convert things like curly quotes in the character encoding to htmlentities
== do the right thing with as much other stuff as possible and then either delete the remainder or report it as an error ...
== save the field back to the database (if no errors)

I've found a UTF-8 character map (dev.networkerror.org/utf8) and may give that a whirl at some point, but for now I think I'm okay ...
Powered by mvnForum

Our Sponsors

  • TEKsystems

    Meeting space and refreshments

  • indieconf 2013

    $20 discount off indieconf 2013 - use code TRIANGLEPHP to save today!

People in this
Meetup are also in:

Sign up

Meetup members, Log in

By clicking "Sign up" or "Sign up using Facebook", you confirm that you accept our Terms of Service & Privacy Policy