Jump to content

Archived

This topic is now archived and is closed to further replies.

chrischen

[SOLVED] unicode display problem

Recommended Posts

I have wordpress installed and it displays all character's correctly. However I made a page myself and queried the wordpress database that contained quotes copy and pasted from microsoft word. In my custom page those characters show up as a diamond with a question mark in it. It shows up correctly in the wordpress page so how do I fix this?

 

The html page is set to utf-8 encoding.

 

Thanks,

Chris

Share this post


Link to post
Share on other sites

" =  "

Share this post


Link to post
Share on other sites

Word sucks cus it uses some non-standard characters. I always have to go in and change them manually. You can try pasting it into Notepad first, but you will loose all your formatting.

 

If you don't want to paste it into notepad, go through and manually change the characters (after you paste it into WP)

Share this post


Link to post
Share on other sites

Here's the thing though: wordpress displays them correctly. So there must be a way to do so without modifying the original text.

Share this post


Link to post
Share on other sites

I bet wordpress uses this to convert special characters (and quotes):

 

htmlentities($var, ENT_QUOTES);

Share this post


Link to post
Share on other sites

The htmlentities didn't work. All it did was take the html code and convert it.

 

In wordpress I viewed source and the quote that I converted to work is like this “ instead of like this ". This is odd because when I view it on my custom page that retrieves it from the database for it displays as ". For the other quotes I didn't change it displays as a diamond with a question mark even in view source.

 

I checked the database and it's stored like “ too. The wordpress db is utf-8, so the problem is with PHP.

Share this post


Link to post
Share on other sites

They're called smart quotes.

 

 

“”

 

The ASCII codes for them are 147 and 148 (hold alt, hit 0147 and let go, and you'll see them ;p).

 

Chances are, wordpress just replaces them with normal quotes.

Share this post


Link to post
Share on other sites

No wordpress doesn't. In fact, wordpress is replacing the normal quotes with the smart ones too.

Share this post


Link to post
Share on other sites

Are you sure?  Microsoft fonts have to be used to show smart quotes, so surely wordpress wouldn't replace normal quotes with sideways ones....

Share this post


Link to post
Share on other sites

Yes they were replaced. And I fixed the problem by adding mysql_query("SET NAMES utf8"); before queries.

Share this post


Link to post
Share on other sites

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.