I almost finished the random quote machine, but I have a bug and I can’t find the solution.
I encode the quote with encodeURIComponent() function, but if the qoute has a special character (eg: ') in it, it becomes converted to a html character code. I tried to convert these html char codes to normal string charachters, but it just doesn’t work. Therefore, if you want to tweet the quote, there is almost always a html char code in it.
here’s my pen:
If somebody could help me with this, I would be greatful.
I might be completely off but aren’t you supposed to be able to make the difference by using double quotes vs single quotes?
Else have you tried regExp and escape signs?
Sorry if it’s totally off.
Just tried to replace all the qoutes (with escape signs) to single then all to double in the tweeting function, but it still didnt work.
Then I tried to decode the string with decodeURIComponent() there replace the html characters to normal characters, and after all encode that with encodeURIComponent(). And it magically works. No html characters in the tweet text. Dont know why, but it works
Thanks for your reply and giving hints
Cool, glad you found a solution - I’ll have to research that, I have no idea what you’re talking about