PHP/MySQL - Special characters in URLs. How to avoid?
- by RC
Hey everyone,
My database contains information extracted from an external feed. In this raw text feed, the following text is used in place of special characters:
& - &
' - &39;
é - é
I extract some of this text to form URLs. For example, a URL that I construct from data containing these characters might look like this:
http://url.com/search/?brand=Franklin&Hédgson's
I use the GET variables in this URL to construct further lookups, which leads to a couple of specific problems:
The é and ' characters are sent back to MySQL as they appear, and so they don't trigger any results (because the characters take the full HTML form in the database text).
The & within the URL separates the variable, and the GET returns only Franklin, when it should return the whole string.
Are there any straightforward ways of dealing with this?
Thanks.