Regarding the random quote machine

Hi everyone, I have pretty much done with the random quote generator, just been having a little bit of problem with the tweet button. In the content of the tweet, some special characters are not being converted back namely en dash, apostrophe, and “…”, couldn’t figure out why. I think I need a bit of help.

Here is my code:

Thank you for reading and potentially helping. Any feedback is appreciated.

Solution: I have later found out the that the API I’m referencing was using HTML entities in their content, which led to the encoding method not working correctly, since they interpret the entities as literals. Had the source used Unicode symbol, no errors would have occured.

I tried several quotes, but I was not able to replicate the problem you described with a dash, did see the issue with the double quotes displaying “ and ” and also the apostrophe displaying ’ Have you considered writing a decoder for those special characters? See the FCC challenged named Convert HTML Entities for more information

PS. Below are screenshots a couple of color combinations where it is very difficult to read the text with a white background.

1 Like

Thank you for the quick response @RandellDawson! I have considered creating a solution for my own but I thought nothing should go wrong when I use the encodeURI/encodeURIComponent method, so I thought maybe I was applying them in a wrong way, will look into the material right away. I also agree about the color usage.