note 42677 modified in function.htmlentities by danbrown

From: Date: Sun, 17 May 2009 17:05:42 +0000
Subject: note 42677 modified in function.htmlentities by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-154939@lists.php.net to get a copy of this message
<?php // tested with PHP 4.3.4, Apache 1.29 // function works like original htmlentities // but preserves Polish characters encoded in CP-1250 // (Windows code page) from false conversion // m227@poczta.onet.pl, 2004 function htmlentities1250($str) { // four chars does not need any conversion // s (9c), z (9f), Z (8f), S (8c) $trans = array( "&sup3;" => "\xb3", // "l-" "&sup1;" => "\xb9", // "a," "&ecirc;" => "\xea", // "e," "&aelig;" => "\xe6", // "c`" "&ntilde;"=> "\xf1", // "n`" "&iquest;"=> "\xbf", // "z." "&yen;" => "\xa5", // "A," "&AElig;" => "\xc6", // "C`" "&macr;" => "\xaf", // "Z." "&Ecirc;" => "\xca", // "E," "&oacute;"=> "\xf3", // "o`" "&Oacute;"=> "\xd3", // "O`" "&pound;" => "\xa3", // "L-" "&Ntilde;"=> "\xd1" // "N`" ); return strtr(htmlentities($str), $trans); } ?> --was-- // tested with PHP 4.3.4, Apache 1.29 // function works like original htmlentities // but preserves Polish characters encoded in CP-1250 // (Windows code page) from false conversion // m227@poczta.onet.pl, 2004 function htmlentities1250($str) { // four chars does not need any conversion // s (9c), z (9f), Z (8f), S (8c) $trans = array( "&sup3;" => "\xb3", // "l-" "&sup1;" => "\xb9", // "a," "&ecirc;" => "\xea", // "e," "&aelig;" => "\xe6", // "c`" "&ntilde;"=> "\xf1", // "n`" "&iquest;"=> "\xbf", // "z." "&yen;" => "\xa5", // "A," "&AElig;" => "\xc6", // "C`" "&macr;" => "\xaf", // "Z." "&Ecirc;" => "\xca", // "E," "&oacute;"=> "\xf3", // "o`" "&Oacute;"=> "\xd3", // "O`" "&pound;" => "\xa3", // "L-" "&Ntilde;"=> "\xd1" // "N`" ); return strtr(htmlentities($str), $trans); } http://php.net/manual/en/function.htmlentities.php

« previous php.notes (#154939) next »