I want to share text in Facebook through the Facebook JavaScript SDK.
So when it is normal text, share is working correcty when I include a whitespace, line break, single quote or double quote. It creates a problem. What should I do to remove such a situation?
As I am retrieving data from a database which might be included with all these spaces, line breaks, single quotes, double quotes or slashes.
FB.ui({
method : 'stream.publish',
name : 'Application Name or some thing else',
picture : 'http://example.com/first.jpg',
caption : 'I want to upload this caption to facebook',
link : 'http://www.example.com',
description : 'I don't want to hide "Facebook page" from any user.
This is like text is not working. What might be the reason, and what should I do?
'
});
What technique should I apply to be safe from a wrong posting? It must accept special characters.
I have written a JavaScript function for this problem. It worked great for me.