note 64163 deleted from function.htmlentities by bjori

From: Date: Fri, 21 Apr 2006 10:17:42 +0000
Subject: note 64163 deleted from function.htmlentities by bjori
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-108909@lists.php.net to get a copy of this message
Note Submitter: fish at goatvirus dot com ---- I tried the regexp that nospam at donadio dot com dot br posted, found it didn't work, and upon closer examination... I don't know why his worked for him (or her), because it seems that the \xAA codes in javascript require AA to be hex, not numeric! Try this regexp instead: function js_escape_string($str){ $str = preg_replace('/[^!-%\x27-;=?-~ ]/e', '"\\x". sprintf("%X",ord("$0"))', $str); } (there's probably a more efficient way of doing this than sprintf, but I was in a rush :-)

« previous php.notes (#108909) next »