Looks like a poorly designed method to avoid SQL injections.
But yeah the right way to do this is to use a well-tested urlencoding library, not to strip out dangerous-looking characters.
IIRC HN runs off a flat file, and doesn't use SQL, or anything else fancy simply because it isn't needed, and or because it adds unneeded complexity.
Not to be confused with NoSQL.