?
Solved

Title in Facebook appears with HTML chars

Posted on 2014-01-21
3
Medium Priority
?
302 Views
Last Modified: 2014-01-21
With my PHP script I'm posting in Facebook timeline. Everything fine as long as I'm posting in English. Trying to post in language with special characters (Greek in this case) I'm getting the Title/Link in HTML character set (see the attachment).

I used:
$fb_title = htmlentities($title, ENT_QUOTES, 'UTF-8');
$fb_summary = htmlentities($bodytext, ENT_QUOTES, 'UTF-8');

Open in new window

and the message appeared ok. The title also appeared ok when I appended it to the message. But when the title is the link, it appears with characters like α etc etc.
timeline-greek.jpg
0
Comment
Question by:NickTERiS
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 111

Accepted Solution

by:
Ray Paseur earned 2000 total points
ID: 39796441
Looks like FB is making the same translation you are.  They've probably had some issues with people who did not know that you need to entitize output before sending it to the browser, or perhaps with people who did not understand character sets.  This is a security issue; if you don't escape the output you're at risk of JavaScript injection and a resulting attack on the client machine.  Facebook cannot afford to become an attack vector.

Please see: http://www.laprbass.com/RAY_temp_nickteris.php

<?php // RAY_temp_nickteris.php
error_reporting(E_ALL);

// IF YOU ALREADY HAVE ENTITIES
$title = '&Alpha;&delta;&omega;&sigma;';
echo $title;

// AND YOU ENTITIZE AGAIN...
$fb_title = htmlentities($title, ENT_QUOTES, 'UTF-8');
echo $fb_title;

Open in new window

Executive summary: Let Facebook do the entitize process and leave it out of your code.  You might want to include a prominent comment explaining why you're not using the traditional and expected escape sequence.
0
 

Author Comment

by:NickTERiS
ID: 39796729
This is that I've already did :) But really appreciate your help.
0
 
LVL 111

Expert Comment

by:Ray Paseur
ID: 39796820
Thanks for the points and thanks for using EE, ~Ray
0

Featured Post

WordPress Tutorial 1: Installation & Setup

WordPress is a very popular option for running your web site and can be used to get your content online quickly for the world to see. This guide will walk you through installing the WordPress server software and the initial setup process.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Facebook has became the #1 social media platform. People share many funny videos there, yet you don't know how to download them? Now you can download Videos from Facebook in just 3 simple steps.
This article discusses how to implement server side field validation and display customized error messages to the client.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…
Suggested Courses

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question