How to solve the apostrophe problem in node title? (&#039; -> ')
Your issue seems similar to what's written in issues such as this or this.

The solution appears to be to use decode_entities, e.g. something like this:

$node-&gt;title = decode_entities($node-&gt;title);