Advertisement

05.05.2008 at 06:20PM PDT, ID: 23378262 | Points: 500
[x]
Attachment Details

UTF-8 and Latin1 WordPress Woes

Zones: MySQL, WordPress
My wp_posts table, upon importing to another blog host, has the garbage that folks refer to that the translation between utf8 and latin1 causes.  So I tried as an experiment issuing a command like :

CREATE TABLE IF NOT EXISTS wp_postsclean SELECT * FROM wp_posts;

The resulting "clean" table appears to no longer have the garbage (I'll check more records to be sure...).

So, what I'd like to do is delete the rows in my wp_post table and insert the rows from the "clean" table.  The question then is does this make sense and how do I do the inserts when the ID field is autonumber (can we turn it off and then back on?)   ?

Thanks,
Howard

Start your free trial to view this solution
Question Stats
Zone: Web Development
Question Asked By: hbash
Question Asked On: 05.05.2008
Participating Experts: 1
Points: 500
Views: 0
Translate:
Loading Advertisement...
05.06.2008 at 07:54AM PDT, ID: 21507780

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.06.2008 at 05:51PM PDT, ID: 21512309

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.07.2008 at 04:33AM PDT, ID: 21515202

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.07.2008 at 04:35AM PDT, ID: 21515211

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.07.2008 at 02:00PM PDT, ID: 21520311

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.07.2008 at 02:09PM PDT, ID: 21520374

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.07.2008 at 02:10PM PDT, ID: 21520379

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.07.2008 at 02:13PM PDT, ID: 21520396

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.08.2008 at 06:58AM PDT, ID: 21524715

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.08.2008 at 07:47AM PDT, ID: 21525200

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.08.2008 at 11:49AM PDT, ID: 21527390

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.08.2008 at 11:53AM PDT, ID: 21527422

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.08.2008 at 12:44PM PDT, ID: 21527823

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.08.2008 at 01:24PM PDT, ID: 21528142

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.08.2008 at 01:49PM PDT, ID: 21528341

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
Loading Advertisement...
Microsoft
  • Internet Protocols
  • Applications
  • Development
  • OS
  • Hardware
  • Windows Security
Apple
  • Operating Systems
  • Hardware
  • Programming
  • Networking
  • Software
Internet
  • Search Engines
  • File Sharing
  • WebTrends / Stats
  • Spy / Ad Blockers
  • Web Browsers
  • New Net Users
  • Web Development
  • Chat / IM
  • Anti Spam
  • Web Servers
  • Anti-Virus
  • Email Clients
Gamers
  • Tips
  • Online / MMORPG
  • Puzzle
  • Emulators
  • Action / Adventure
  • Role Playing
  • Consoles
  • Game Programming
  • Strategy
  • Sports
  • Misc
  • Computer Games
Digital Living
  • Hardware
  • New Net Users
  • New Users
  • Software
  • Digital Music
  • Gaming World
  • Home Security
  • Apple
  • Networking Hardware
Virus & Spyware
  • Vulnerabilities
  • IDS
  • Encryption
  • Anti-Virus
  • Operating Systems Security
  • Software Firewalls
  • WebApplications
  • Cell Phones
  • Operating Systems
  • Internet
  • Hardware Firewalls
Hardware
  • Handhelds / PDAs
  • Displays / Monitors
  • Components
  • Networking Hardware
  • Peripherals
  • Laptops/Notebooks
  • Storage
  • Servers
  • Desktops
  • New Users
  • Misc
  • Apple
Software
  • System Utilities
  • Industry Specific
  • Network Management
  • Photos / Graphics
  • Page Layout
  • VMWare
  • Misc
  • Web Development
  • OS
  • CYGWIN
  • Voice Recognition
  • Message Queue
  • Quality Assurance
  • Security
  • Firewalls
  • MultiMedia Applications
  • Development
  • Database
  • Office / Productivity
  • Business Management
  • OS/2 Apps
  • Server Software
  • Internet / Email
ITPro
  • OS
  • Storage
  • Encryption
  • Operating Systems Security
  • Apple Hardware
  • Laptops & Notebooks
  • Servers
  • Networking Hardware
  • Peripherals
  • Devices
  • Displays / Monitors
  • WebTrends / Stats
  • Search Engines
  • Firewalls
  • WebApplications
  • IDS
  • Vulnerabilities
  • Email Clients
  • File Sharing
  • Spy / Ad Blockers
  • Web Browsers
  • Web Servers
  • Networking
  • Anti-Virus
  • Chat / IM
  • Anti Spam
Developer
  • Web Servers
  • Web Browsers
  • Game Programming
  • Dev Tools
  • Industry Specific
  • Office / Productivity
  • Database
  • CYGWIN
  • Web Development
  • Search Engines
  • File Sharing
  • WebTrends / Stats
  • Programming
  • Content Management
  • Application Servers
  • Protocols
Storage
  • Removable Backup Media
  • Storage Technology
  • Servers
  • Grid
  • Remote Access
  • Backup / Restore
  • Misc
  • Hard Drives
OS
  • Miscellaneous
  • Security
  • Development
  • Linux
  • VMWare
  • MainFrame OS
  • Unix
  • Apple
  • OS / 2
  • AS / 400
  • BeOS
  • Microsoft
  • VMS / OpenVMS
Database
  • Oracle
  • Miscellaneous
  • MySQL
  • Software
  • Sybase
  • Contact Management
  • PostgreSQL
  • Data Manipulation
  • Clarion
  • InterSystems Cache
  • Siebel
  • MUMPS
  • OLAP
  • SQLBase
  • SAS
  • GIS & GPS
  • 4GL
  • Berkeley DB
  • DB2
  • Informix
  • Interbase / Firebird
  • FoxPro
  • Reporting
  • LDAP
  • Filemaker Pro
  • MS SQL Server
  • dBase
  • MS Access
Security
  • Misc
  • Web Browsers
  • Software Firewalls
  • Operating Systems Security
  • File Sharing
  • Spy / Ad Blockers
  • Vulnerabilities
  • WebApplications
  • IDS
  • Anti-Virus
  • Encryption
  • Anti Spam
  • Email Clients
  • VPN
  • Chat / IM
Programming
  • Editors IDEs
  • Installation
  • Handhelds / PDAs
  • Multimedia Programming
  • System / Kernel
  • Algorithms
  • Game
  • Signal Processing
  • Project Management
  • Open Source
  • Database
  • Misc
  • Languages
  • Processor Platforms
  • Theory
Web Development
  • Scripting
  • Blogs
  • Web Servers
  • Software
  • Search Engines
  • Web Graphics
  • Images
  • Internet Marketing
  • Images and Photos
  • Components
  • Document Imaging
  • Web Languages/Standards
  • Illustration
  • WebApplications
  • Fonts
  • WebTrends / Stats
  • Authoring
  • Digital Camera Software
  • Miscellaneous
Networking
  • Protocols
  • Apple Networking
  • Network Management
  • Message Queue
  • Application Servers
  • Content Management
  • File Servers
  • Email Servers
  • Misc
  • Java Editors & IDEs
  • Wireless
  • Networking Hardware
  • Backup / Restore
  • System Utilities
  • ISPs & Hosting
  • Web Servers
  • Storage Technology
  • Removable Backup Media
  • Servers
  • Broadband
  • Grid
  • OS / 2
  • Novell Netware
  • Unix Networking
  • Windows Networking
  • Security
  • Telecommunications
  • Operating Systems
  • Linux Networking
Other
  • Community Advisor
  • Lounge
  • Community Support
  • New Net Users
  • Philosophy / Religion
  • Math / Science
  • Miscellaneous
  • URLs
  • Expert Lounge
  • Politics
  • Puzzles / Riddles
Community Support
  • Suggestions
  • New to EE
  • New Topics
  • Community Advisor
  • CleanUp
  • Announcements
  • General
  • Feedback
  • Input
  • EE Bugs
 
05.06.2008 at 07:54AM PDT, ID: 21507780
yes you can turn off the auto number and copy the daat back over, then tunr auto number back on, imwould suggest you make a full back up before doing this.

on windows use teh mySQL query browser, open teh db and right click on the table and select edit,
uncheck the auto-increment and add a default value of 999 (the field is set to not null so it needs a default value) copy over the clean data then edit the table again, change the default to not null and check the auto-increment

make sure you have a full backup before doing this!
 
05.06.2008 at 05:51PM PDT, ID: 21512309
Do you know the commands disable/enable the table and set it's default ? I am using phpmyadmin, not mysql.

Thanks,
Howard
 
05.07.2008 at 04:33AM PDT, ID: 21515202
i have not used phpmyadmin so not sure of the commands
in that case what you might want to do is  a straight update query from the clean data table abd ovewrite the curent bad content

select all records from good table
loop over records
update bad table with new record values where good tabel id = bad table id
 
05.07.2008 at 04:35AM PDT, ID: 21515211
 
05.07.2008 at 02:00PM PDT, ID: 21520311
When you run phpmyadmin,  you have a mysql query window available that would allow one to run valid mysql in.

 
05.07.2008 at 02:09PM PDT, ID: 21520374
ok then give this a try

UPDATE  POSTS A, CLEAN_POSTS  B
SET  A.COLNAME= B.COLNAME
WHERE A.ID=B.ID

where colname is the name of the column you are updating with teh clean data
 
05.07.2008 at 02:10PM PDT, ID: 21520379
oh yea...

make a back-up BEFORE testing that code
 
05.07.2008 at 02:13PM PDT, ID: 21520396
or

UPDATE POSTS AS P, (SELECT * FROM CLEAN_POSTS) AS CP SET
P.COLNAME=CP.COLNAME,
P.COLNAME2=CP.COLNAME2,
P.COLNAME3=CP.COLNAME3
WHERE P.ID=CP.ID
 
05.08.2008 at 06:58AM PDT, ID: 21524715
The problem with the above suggestions is that the clean table auto number column values do not necessarily match those in the dirty table.  

This is the case since there have been rows deleted from the dirty table prior to my copying that table to the clean table where the clean table did consecutive auto numberings.  

I think that sql to turn off the auto numbering on the dirty table, doing inserts from the clean table, followed by turning on the autonumber with a start value = max(autocol) +1 .

 
05.08.2008 at 07:47AM PDT, ID: 21525200
>>This is the case since there have been rows deleted from the dirty table prior to my copying that table to the clean table where the clean table did consecutive auto numberings.
can you redo the data clean to a new table without an auto number id column?
 
05.08.2008 at 11:49AM PDT, ID: 21527390
These auto number values are needed to line up comments with posts, so if the values do not match,  we get no comments for a post.

I'm not sure what or why you would want the clean data written to a table that does not have the autonumber field (ID field),  but I could build a "clean" table without the auto number column.
 
05.08.2008 at 11:53AM PDT, ID: 21527422
no, export all the data to a new table, but the new table id field should not be autonumber to maintian the crossreference, you d\said the numbers in thew clean data table do not match the opriginal table, if that is the case you need toperforma a new export/clean or do manual updates
 
05.08.2008 at 12:44PM PDT, ID: 21527823
And then update the dirty table as in  your example :

UPDATE  POSTS A, CLEAN_POSTS  B
SET  A.COLNAME= B.COLNAME
WHERE A.ID=B.ID

?
 
05.08.2008 at 01:24PM PDT, ID: 21528142
yes, unless you have corresponding ID's between the two tables you cannot crossreference them and you would need to examine each record and do a manula update.

how did you clean the data on the export?
 
05.08.2008 at 01:49PM PDT, ID: 21528341
i used the built in export db command from phpMyAdmin and read the file into textpad.  Textpad seems to be very good at figuring out how to read text (PC, UNIX...) and on saving the text file to a pc format,  it was cleaned.  I then ran the sql the exported and saved textfile for the dirty table, changing the name to wp_posts_clean and that was it.
 
 
20080236-EE-VQP-29 / EE_QW_2_20070628