Skip to content
Advertisement

Tweets from API have strange characters (Abraham library)

I’m using this library (Abraham twitteroauth) to pull tweets from a timeline like so…

JavaScript

And everything works fine, but the output has a lot of funny characters lik ““” in place of double quotes.

Does anyone know why this happens?

Advertisement

Answer

The results you get from the library are in UTF-8. Set the character set of your output correctly or use the correct escaping functionality.

For example, when you are outputting to HTML, you can set the character set of the page to UTF-8:

JavaScript

Or, you can escape the characters with htmlentities:

JavaScript
User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement