Apostrophes showing up as ASCII

Apostrophes showing up as ASCII
0

#1

Here’s a link to my codepen to begin: https://codepen.io/UCDTtbot/pen/LOEbmN?editors=1010

I’m getting my random quotes from a wordpress API, https://quotesondesign.com/api-v4-0/

This API returns the content of the quote as JSON. The content component is structured like:

    "content": "<p>Everything we do communicates.</p>\n",
    /* ...snip most of the fields... */
    "title": "Pete Episcopo",

As you can see, the content section has HTML tags but I’ve found a function borrowed from PHP that strips these tags however. However, I’m having the issue that any special character is showing up as ASCII. I’ve tried changing the projects character set, but that isn’t working.

I realize I could just do $(.quote).html = content, however that then screws up the fa-quote line up, as it puts the quote on a new line after my icon.

Can anyone think of a good fix? To either make sure that special characters don’t come out as ASCII, or how I could re-align my fa-quote after changing the html of $(.quote)???

Thanks in advance.


#3

I’m not too strong with my regular expressions, so I can’t 100% verify if your regex is right in your striptags function, but it seems as though it is perfectly fine.

Have you still noticed this problem? Because I’ve looked at your codepen, and it seems to be fine for me on my end.

And I should say, I really like your implementation of using WP to get your quotes