note 62748 added to function.setlocale

From: Date: Wed, 08 Mar 2006 20:17:20 +0000
Subject: note 62748 added to function.setlocale
Groups: php.notes 
Request: Send a blank email to php-notes+get-105074@lists.php.net to get a copy of this message
The example from bruno dot cenou at revues dot org below shows the possibility, but I want to spell it out: you can add charset info to setlocale. Example: Into my utf-8-encoded page I want to insert the name of the current month, which happens to be March, in German "März" - with umlaut. If you use setlocale(LC_TIME, 'de_DE'); echo strftime("%B"); this will return "März", but that html-entity will look like this on a utf-8 page: "M?rz". Not what I want. But if you use setlocale(LC_TIME, 'de_DE.UTF8'); // note the charset info ! echo strftime("%B"); this returns "M√§rz", which, on utf-8, looks like it should: "März". ---- Server IP: 217.13.201.10 Probable Submitter: 80.128.216.55 ---- 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.setlocale.php Edit -- http://master.php.net/note/edit/62748 Del: integrated -- http://master.php.net/note/delete/62748/integrated Del: useless -- http://master.php.net/note/delete/62748/useless Del: bad code -- http://master.php.net/note/delete/62748/bad+code Del: spam -- http://master.php.net/note/delete/62748/spam Del: non-english -- http://master.php.net/note/delete/62748/non-english Del: in docs -- http://master.php.net/note/delete/62748/in+docs Del: other reasons-- http://master.php.net/note/delete/62748 Reject -- http://master.php.net/note/reject/62748 Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#105074) next »