-
how to fix wordpress unreadable codes for previous next lable?
by j2trip on 1:41 AM
Comments (2)
This issue is simple, but if you don’t know where’s the reason, you’ll be crazy.
All because my own wordpress theme, The theme was designed for English website at first. But now I need to make it support Japanese. So I install a new wordpress, and set the “Encoding for pages and feeds” to UTF-8.
I could view posts that its characters were Japanese, but all lables like “previous post”, “previous page”, “next post”… are english. So I wanted to change them into Japanese also.
First I attempt to change the default “Previous” “Next” to “以前の” and “次の” in Japanese. I added following codes:
<div>
<div><?php previous_post_link(’以前の%link’) ?></div>
<div><?php next_post_link(’%link 次の’) ?></div>
</div>But I met unreadable codes(unreadable characters) . Just like following screenshot:

I try again and again, but it was still unreadable codes. I checked the source file of the page, its charset was right, just UTF-8.

Suddenly I realized may be the error caused by encoding of the theme files. Because the files all are english first, may be its encoding is lartin and not UTF-8.
I checked the encoding of single.php. Good luck, I found out the reason, the encoding of the file was not UTF-8. So When I chaged the previous and next lable to Japanese, them couldn’t be displayed correctly. Although the charset of the page setted to UTF-8.
I got out this: the encoding of the file must be same with charset of the meta in the header. It is to say, if your html files’ charset set to <meta http-equiv=”Content-Type” content=”text/html; charset=UTF-8″ />, then the encoding of the file must be set to UTF-8 also.
PS: I used Adobe Dreamwaver CS3 to check and re-set the page’s encoding. You may press CTRL + J on your keyboard, then you’ll find the title/encoding on the dialogue, change the encoding and all will be OK.

Enjoy yourself.




Thanks very much for that well written piece of text.
September 13, 2009 9:44 PMNice content indeed! i will visit as often as i can.
cheers
September 18, 2009 8:56 PM