I creat new customize theme for wordpress and all things was right, just when I upload it on host my characters changed to something like نوشته‌های تازه. I use meta charset="UTF-8" in my php code, and I use this query in phpmyadmin: SET NAMES UTF8; http://maideh.ir/issue/ --> its my uploaded theme! can any one help me? (excuse me for my poor english language;-))
Asked
Active
Viewed 231 times
1
-
Is the file "saved" as UTF-8 and are you also including the proper meta in your header? I.e.: `` – Funk Forty Niner Dec 25 '13 at 23:14
-
@Fred -ii- yes I used exactly – vahid kargar Dec 25 '13 at 23:25
-
1yet is the file itself saved in UTF-8, and not just a plain text Notepad file? Notepad by default, does not save in UTF-8 but as ANSI. – Funk Forty Niner Dec 25 '13 at 23:30
-
@Fred -ii- yes all of my files saved in utf-8 – vahid kargar Dec 25 '13 at 23:33
-
See question and answers here, might help. http://stackoverflow.com/questions/913869/how-to-change-the-default-encoding-to-utf-8-for-server may be a serverside issue. – Funk Forty Niner Dec 25 '13 at 23:51
-
Please tell us a bit more. What characters changed? Were they originally in a non-Roman language (Cyrillic, Arabic, etc)? Are the characters in question stored in some theme file, or in the WordPress database instance? How did you upload the theme to the server? (FTP? WordPress's Install Themes/Upload page?) What tools did you use to create the theme? (Notepad? an IDE?) – O. Jones Dec 25 '13 at 23:52
-
@Ollie Jones:1)all of my characters changed 2)my characters is in persian language 3)no one are in question stored 4)I first install latest WP after I zip my theme and extract that on theme directory 5)sublime Text – vahid kargar Dec 26 '13 at 06:24
-
@Fred -ii- your probability is fail because when I switch my theme it works properly! – vahid kargar Dec 26 '13 at 06:34
-
There are too many things that stand to go wrong when using UTF-8. I'm glad you were able to figure out what the problem was. @vahidkargar – Funk Forty Niner Dec 26 '13 at 14:44
2 Answers
2
oh... in my functions.php after latest line "?>" I have 2empty line(enter), after I delete thease empty lines it work properly!

vahid kargar
- 800
- 1
- 9
- 23
-
Aha! functions.php gets loaded first, before your theme's template file (index.php or whatever). If functions.php (or any php file for that matter) contains blank lines, php conveniently sends them to the browser. If they come before your theme's `` items, php helpfully inserts a (wrong) batch of `` items. – O. Jones Dec 26 '13 at 13:37
-
Oh, that's right, I forgot it makes you wait to accept your own answer. – O. Jones Dec 26 '13 at 14:10
-
0
make sure that your host characters are in utf-8, your document charset type is also utf-8. using
mysql_query('set names utf8')
brefore you query the database. for example
mysql_query('set names utf8');
mysql_query('select * from table')
-
In your question, you run this in **phpmyadmin**, what i want you do is run when you connect to mysql data in php – Danny Lee Dec 26 '13 at 07:03
-
In the page http://maideh.ir/issue/ it seems your meta label does not work even though your syntax is right. The default encoding is set to Western(ISO-8859-1). I am afraid that you need to check main page's document encoding – Danny Lee Dec 26 '13 at 07:15
-
I see some questions that answered like your answer. if you read again above comments, I said when I switch my theme, all things is right, so it seems that my issue isnt relate to database! Tnx for your answer. – vahid kargar Dec 26 '13 at 07:17
-
whats your mind about "you need to check main page's document encoding"? please explain more. – vahid kargar Dec 26 '13 at 07:19
-
In the page maideh.ir/issue, I noticed that words in center are right, just words on the left have encode problem. Does word in center are plain text and words on the left are query result from database ? http://wordpress.org/support/topic/utf-8-encoding-problem – Danny Lee Dec 26 '13 at 07:21