I have a function that builds an anchor tag. The function receives the URL, Title as parameters. The problem is that once the text includes quotation marks, and this leads to an anchor tag generated with syntax errors.
What is the best way to solve these problems? Is there any function that parses the text in a safe string, in this case for the title attribute.
Otherwise, I can check the string and remove all the quotes, but I would like to know if there is a better way to do this, for example, there may be some other characters that could also cause my function to crash.
source share