Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I moved my wordpress installation from server to localhost on my pc using the instructions in the following link http://www.premiumwebbloghosting.com/2012/07/moving-wordpress-from-hosting-to-localhost.html. I used the second option.

After completing the process everything works fine on my pc. I can log to the admin panel using same users, i can access all pages on the website. There was only one problem which is the images are not showing.

The images i uploaded to the website were named in Arabic alphabet, therefore were encoded by wordpress and resulted in weird file names!!

I noticed that the file names are different than the one in the moved database. The original file name (after upload through wordpress) would be: ط¨ظٹط§ظ†ظ.
The file on my pc would be(not the actual file, the link on the database): جئون-ÙÙ.

What is the reason of this change? I exported the database using UTF8. Why the file names changed when i moved the database to my local development pc?

Another thing, Is there a way to prevent wordpress from encoding file names in Arabic, I would like my pictures in the uploads folder to have the same Arabic names, not weird letters!!

EDIT: I just noticed that the links in server and localhost are the same before decoding, but they translate differently. Example: server link: http://mywebsite.com/wp-content/uploads/2014/01/%D8%A7%D9%84%D8%A7%D9%85%D8%A7%D8%B1%D8%A7%D8%AA.jpg localhost link: http:/localhost/wp-content/uploads/2014/01/%D8%A7%D9%84%D8%A7%D9%85%D8%A7%D8%B1%D8%A7%D8%AA.jpg but the link translate to different value than the picture's file name!

share|improve this question
    
Maybe you should try the WordPress Export tool and see if that fixes it. –  Brad Dalton Jan 3 at 19:57
    
will import overwrite old posts? or do i have to delete theme manually? –  hfatahi Jan 3 at 20:01
    
Not sure but i doubt that matters. Try both as you have backup and access to your old server and content. –  Brad Dalton Jan 3 at 20:03
    
I tried. Nothing changes. Still the encoded name in the database different than the saved file name!! –  hfatahi Jan 3 at 20:14
    
I normally use the WP Migrate DB plugin to search, find and replace the links. –  Brad Dalton Jan 3 at 20:16
show 1 more comment

1 Answer

The tip in Part 2 at the site you link that reads

Unzip the database you've downloaded and open it with text editor (Notepad++ or Dreamweaver) and use "Find and Replace" option to change "http://olddomain.com" with "http://newdomain.com" and then import it with phpmyadmin.

is absolutely wrong. Running a find/replace on a database dump with a text editor will break serialized data at least. And at most, it may may break character encodings if the text editor is not Unicode aware. Either might be your problem.

Use http://interconnectit.com/products/search-and-replace-for-wordpress-databases/ to correctly deserialize/reserialize data during a find/replace by running the script on the server. Read the docs for it. I've used it many times.

The other thing that may be going on is that your database encoding on your localhost may be different than the live server. Check both wp-config.php files for the setting define( 'DB_CHARSET', 'utf8' ); that should be the same.

See http://codex.wordpress.org/Editing_wp-config.php#Database_character_set

Edit: The docs above say:

There usually should be no reason to change the default value of DB_COLLATE. Leaving the value blank (null) will insure the collation is automatically assigned by MySQL when the database tables are created.

share|improve this answer
    
i didn't use the find/replace in notepad++. I used SQL queries insted. The encoding is utf8 both on production and development environments. Does DB_Collate has anything to do with it, it's blank in both!! –  hfatahi Jan 3 at 21:30
    
also i mentioned that the encoded url is the same on server and localhost but it does translate to a different file name on my pc –  hfatahi Jan 3 at 21:31
    
See edit above; a blank DB_Collate is fine. What is the local PC? Windows? OS X? Are you using a language localization other than English on the PC? –  songdogtech Jan 3 at 21:36
    
i'm using windows 8. English is the default. I have only Arabic set as the language of choice for non-unicode programs –  hfatahi Jan 3 at 21:48
    
What type of localhost setup? Windows that you installed yourself or WAMP? –  songdogtech Jan 6 at 14:26
show 2 more comments

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.