When I copy a domain name from Google Maps and then paste it into a form I built, it enters it into a MySQL database with ‎ appended at the end of the domain name.
Any idea how I could strip that ‎ off of the domain name?
The relevant code is below
<div class="friend5title"><label for="url">Website:</label></div>
<div class="friend5field"><input name="website" type="text" id="website" maxlength="150"></div>
$website = mysql_real_escape_string($website);
mysql_query("INSERT INTO submission VALUES ('$website')");
It is a control character ( http://en.wikipedia.org/wiki/Left-to-right_mark ).
Ignore all of my previous answer I just realized (since I wrote quickly) it isn’t in unicode it is actually in a HTML entity format so you need to strip that HTML entity out:
An alternative is to actually purify your string and purge it of all HTML entities since it shouldn’t really have any in it. Normally there could be special characters like
&but these should not exist in a URL taken from an input field I reckon.Here is a question about removing HTML entities with a solid answer: How to remove html special chars?
As to why it is happening: it is possible that someone has a foreign browser which artifically makes the text in inputs go a certain way but in turn by adding this html entity.