note 41293 added to function.utf8-encode

From: Date: Mon, 05 Apr 2004 23:12:10 +0000
Subject: note 41293 added to function.utf8-encode
Groups: php.notes 
Request: Send a blank email to php-notes+get-67674@lists.php.net to get a copy of this message
Good news is that utf8_encode (like UTF-8) passes '<', '>', '/', '\'', '"', etc., so you are free to utf8_encode complete blocks of html text that includes tags. Bad news is that UTF-8 is stupid enough so that utf8_encode(utf8_encode($str)) != utf8_encode($str) in most of the cases. What you can do is write utf8_ensure like: function utf8_ensure($str) { return seems_utf8($str)? $str: utf8_encode($str); } Comes handy when your view library tries to encode the same text multiple times. ---- Manual Page -- http://www.php.net/manual/en/function.utf8-encode.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+41293 Delete -- http://master.php.net/manage/user-notes.php?action=delete+41293&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+41293&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#67674) next »