Chris Hansen
Chris Hansen

Reputation: 8639

apostrophes turns crazy on facebook app

I have text with apostrophes and I use facebook to share the text on my wall. When I do that, however, the text is posted strangely on facebook - the apostrophes become '. What can I do to prevent this?

I am using PHP and Facebook graph API.

Upvotes: 0

Views: 1889

Answers (3)

Free Radical
Free Radical

Reputation: 2072

I just checked with Drupal 7, and it will replace Unicode Character 'APOSTROPHE' with its NCR equivalent (') in headings. This is not a bug, but a security measure.

Appearently, when FaceBook receives this, it changes it to &#39, with the result you observe. IMHO, this is a bug in how Facebook treats incoming NCRs, and has nothing to do with Drupal. (It is not a good idea for Drupal to have plain apostrophes in headings.) You may want to report this bug to Facebook, but it will probably not be their top priority.

You may also add a feature request to the authors of the module the sites uses to interact with FaceBook, asking it to rewrite NCR apostrophes into a single byte ASCII before sending to FaceBook. They may be more symphatetic.

Upvotes: 0

Christian Giupponi
Christian Giupponi

Reputation: 7618

I use:

html_entity_decode($text, ENT_QUOTES, "UTF-8")

and works perfectly with FB

Upvotes: 1

Chris M
Chris M

Reputation: 131

convert the apostrophe to

'

then send it to facebook

Upvotes: 2

Related Questions