Reputation: 61
I have functionality to Autotweet text into twitter account. Everything is working fine, but when text contains any single quotes , It post in to twitter as below..
Example: Actual text and expected result : Maneka's 'Beti Bachao' drive goes live
Text displayed in twitter : Maneka�s �Beti Bachao� drive goes live
Please let me know how to escape these single quotes while in php.
Regards, Kiran.
Upvotes: 0
Views: 260
Reputation: 16086
Try to use htmlentities() like this:
<?php
$str = "A 'quote' is <b>bold</b>";
// Outputs: A 'quote' is <b>bold</b>
echo htmlentities($str);
// Outputs: A 'quote' is <b>bold</b>
echo htmlentities($str, ENT_QUOTES);
?>
Upvotes: 1