View Full Version : Is '?' a Special Character?
weirleader
12-30-2006, 01:52 PM
Trying to fumble my way through CGI for the first time and seem to be having trouble with a '?' in one of my lines of code. To be honest, it's not really MY code - but code that was made available to me. My best guess as to its purpose is to remove the ? symbols from a database and replace them with a different character (the actual line of code follows):
$var =~ s/?/ü/go;
when I replace the ? with another character (for example, I tried X) everything works (but not as originally intended). Which is what leads me to believe it's a special character.
Any help would be appreciated!
Pethens
12-30-2006, 02:20 PM
It looks like you are having character encoding issues. Believe it or not, the "?" is meant to be a letter "u" with an umlaut over it: ü. This is likely because the html string ü represents a letter "u" with an umlaut and that is what it would be replacing.
So using an appropriate text editor (Wordpad works for me), insert a "ü" in place of that question mark and you should be fine. You may also have other question marks in your file that are meant to be other special characters, in which case you will have to fix them as well. You could also go back to the original file and try to get it to the bluehost server without messing up the character encoding this time.
PS: You were right to guess that "?" is a regular expression special character and that's why the replace is not working, but your real problem is with the character encoding.
Hope that helps,
Stephen
weirleader
12-30-2006, 03:44 PM
That's exactly it! I knew enough to have a guess at the problem, but not enough to identify the umlaut character code... makes a lot of sense. And, fortunately, hardly affects my database.
Thanks again!
vBulletin® v3.7.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.