note 40253 added to function.strtr

From: Date: Thu, 26 Feb 2004 17:04:59 +0000
Subject: note 40253 added to function.strtr
Groups: php.notes 
Request: Send a blank email to php-notes+get-65816@lists.php.net to get a copy of this message
Latin1 (iso-8859-1) DONT define chars \x80-\x9f (128-159), but Windows charset 1252 defines _some_ of them -- like the infamous msoffice 'magic quotes' (\x92 146). Dont use those invalid control chars in webpages, but their html (unicode) entities. See ftp.unicode.org/Public/MAPPINGS/VENDORS/MICSFT/WINDOWS/CP1252.TXT or http://www.microsoft.com/typography/unicode/1252.htm PS: a '?' in the code means the win-cp1252 dont define the given char. $badlatin1_cp1252_to_htmlent = array( '\x80'=>'&#20AC;', '\x81'=>'?', '\x82'=>'&#201A;', '\x83'=>'À', '\x84'=>'&#201E;', '\x85'=>'ߪ', '\x86'=>'ߤ', \x87'=>'ߥ', '\x88'=>'&#02C6;', '\x89'=>'߮', '\x8A'=>' ', '\x8B'=>'߷', '\x8C'=>'˜', '\x8D'=>'?', '\x8E'=>'&#017D;', '\x8F'=>'?', '\x90'=>'?', '\x91'=>'ߢ', '\x92'=>'ߣ', '\x93'=>'&#201C;', '\x94'=>'&#201D;', '\x95'=>'ߦ', '\x96'=>'ߝ', '\x97'=>'ߞ', '\x98'=>'&#02DC;', '\x99'=>'ࡊ', '\x9A'=>'¡', '\x9B'=>'&#203A;', '\x9C'=>'™', '\x9D'=>'?', '\x9E'=>'&#017E;', '\x9F'=>'²' ); $str = strtr($str, $badlatin1_cp1252_to_htmlent); ---- Manual Page -- http://www.php.net/manual/en/function.strtr.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+40253 Delete -- http://master.php.net/manage/user-notes.php?action=delete+40253&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+40253&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#65816) next »