Created
February 25, 2015 07:56
-
-
Save kt81/36887de8b13ea2dd7047 to your computer and use it in GitHub Desktop.
SQLでhtmlspecialchars的な事をしようとしたことの名残
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE OR REPLACE FUNCTION orig_htmlspecialchars(TEXT) RETURNS TEXT AS $$ | |
SELECT | |
regexp_replace( | |
regexp_replace( | |
regexp_replace( | |
regexp_replace( | |
regexp_replace($1, | |
E'&(?!(?:#\\d+?|\\w+?);)', '&', 'g'), | |
E'"', '"', 'g'), | |
E'''', ''', 'g'), | |
E'<', '<', 'g'), | |
E'>', '>', 'g') | |
$$ LANGUAGE SQL; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment