Reputation: 799
I am writing an engine so that I can read an RSS feed and post into my Oracle database however when getting an apostrophe from the RSS feed, and inserting into the database, I'm getting ’
when looking in the database after INSERT
however the initial string in PHP is ’
. Is there any way in the Oracle insert to ensure that it stays as ’
rather than changing to ’
I have tried using
$variable = "Someone’s String"
$sql = "INSERT INTO table (column) VALUES (q'[" . $variable. "]')"
I am also having the same issue with the characters £
and –
which are displaying as £
and –
However this doesn't seem to work - Please could you shed some light on the situation
Upvotes: 0
Views: 339
Reputation: 121010
Your RSS feed contains entities, so you need to convert them to their string representations. html_entity_decode
comes to the rescue:
INSERT INTO table (column)
VALUES (html_entity_decode($variable, ENT_QUOTES | ENT_XML1))
Please note that the result drastically depends on flags (second parameter.) Hope this helps.
Upvotes: 1