note 117078 added to function.mb-convert-encoding
| From: | stangerroman at gmail dot com | Date: | Sun, 12 Apr 2015 20:04:55 +0000 |
| Subject: | note 117078 added to function.mb-convert-encoding | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-202237@lists.php.net to get a copy of this message | ||
Russian symbols.
I used scandir() to get a directory content. It had files with english and russian names.
The original structure:
Guide.txt
УÑебник.txt
I used this code:
<?php
$path="C:/Documents/test";
$list=scandir($path);
$list=join("\n",$list);
echo "<pre>".$list."</pre>";
?>
And the result was:
Guide.txt
�������.txt
So I used the CP1251 or Windows-1251 encoding:
<?php
$list=mb_convert_encoding($list, "utf-8", "cp1251");
?>
So the result showed in english and russian.
----
Server IP: 72.52.91.14
Probable Submitter: 91.206.110.88
----
Manual Page -- http://php.net/manual/en/function.mb-convert-encoding.php
Edit -- https://master.php.net/note/edit/117078
Del: integrated -- https://master.php.net/note/delete/117078/integrated
Del: useless -- https://master.php.net/note/delete/117078/useless
Del: bad code -- https://master.php.net/note/delete/117078/bad+code
Del: spam -- https://master.php.net/note/delete/117078/spam
Del: non-english -- https://master.php.net/note/delete/117078/non-english
Del: in docs -- https://master.php.net/note/delete/117078/in+docs
Del: other reasons-- https://master.php.net/note/delete/117078
Reject -- https://master.php.net/note/reject/117078
Search -- https://master.php.net/manage/user-notes.php