note 64163 added to function.htmlentities

From: Date: Sun, 09 Apr 2006 05:57:30 +0000
Subject: note 64163 added to function.htmlentities
Groups: php.notes 
Request: Send a blank email to php-notes+get-107581@lists.php.net to get a copy of this message
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 :-) ---- Server IP: 216.235.15.211 Probable Submitter: 24.87.68.113 ---- X-Spam-Status: No, hits=3.1 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER autolearn=no version=2.64 ---- Manual Page -- http://www.php.net/manual/en/function.htmlentities.php Edit -- http://master.php.net/note/edit/64163 Del: integrated -- http://master.php.net/note/delete/64163/integrated Del: useless -- http://master.php.net/note/delete/64163/useless Del: bad code -- http://master.php.net/note/delete/64163/bad+code Del: spam -- http://master.php.net/note/delete/64163/spam Del: non-english -- http://master.php.net/note/delete/64163/non-english Del: in docs -- http://master.php.net/note/delete/64163/in+docs Del: other reasons-- http://master.php.net/note/delete/64163 Reject -- http://master.php.net/note/reject/64163 Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#107581) next »