SimpleXML & html entities = strange characters

I am getting a feed as such..

$posts = new SimpleXMLElement(WP_ROOT_URL . 'feed/', 0, true);

In this feed one of the items I am getting contains a html entity, which is the entity for the "hyphen character", which is –

However when this is returned from SimpleXML all I get is a –. I have read other similar questions on SO & some mention to make sure your page is set to UTF-8; though not sure how this will stop SimpleXML from returning the strange character?

Any which way I do have this on the page the data is output on:

<meta http-equiv="content-type" content="text/html; charset=utf-8" />

What can I do here to get the correct entity?


In PHP strings don't have unified or managed encoding, therefore you cannot think of them as containing characters but bytes. The result always contains the bytes 0xE28093, only the interpretation changes. You can see this by calling bin2hex() on the result.

The bytes interpreted in Windows-1252 come out as –, interpreted in UTF-8, they come out as –.

If you are echoing this on a web page, then you can make browser interpret your output in UTF-8 by doing:

header("Content-Type: text/html; charset=UTF-8"); //Put this before any output
echo "stuff"; 

Need Your Help

Java - Why are my inserts so slow?

java mysql

Somehow my MySQL Inserts are really slow. Even when I use "Batch-Inserts". About 50 inserts take up to 2000ms.. Is this normal or is there a way to improve my code?

Dragging across an android button


I would like an android button to be triggered if a user drags across it and releases his finger on it in addition to the standard activation if it is clicked and released.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.