note 86903 added to function.iconv

From: Date: Mon, 10 Nov 2008 02:35:53 +0000
Subject: note 86903 added to function.iconv
Groups: php.notes 
Request: Send a blank email to php-notes+get-146332@lists.php.net to get a copy of this message
I used to have problems with Latin characters in UTF-8 while exporting text to PEAR xls writer. This little conmbination solved my problem, you might want to try something like that: <?php function convert_locale_for_xls ($text) { $return = iconv('UTF-8', 'cp1250', $text); return preg_replace("/([\xC2\xC4])([\x80-\xBF])/e", "chr(ord('\\1')<<6&0xC0|ord('\\2')&0x3F)", $return); } ?> ---- Server IP: 69.147.83.197 Probable Submitter: 82.208.253.153 ---- Manual Page -- http://www.php.net/manual/en/function.iconv.php Edit -- https://master.php.net/note/edit/86903 Del: integrated -- https://master.php.net/note/delete/86903/integrated Del: useless -- https://master.php.net/note/delete/86903/useless Del: bad code -- https://master.php.net/note/delete/86903/bad+code Del: spam -- https://master.php.net/note/delete/86903/spam Del: non-english -- https://master.php.net/note/delete/86903/non-english Del: in docs -- https://master.php.net/note/delete/86903/in+docs Del: other reasons-- https://master.php.net/note/delete/86903 Reject -- https://master.php.net/note/reject/86903 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#146332) next »