PHP Classes

Problem with handling chinese named files

Recommend this page to a friend!

      Top level forums  >  PHP Specialists  >  General  >  Problem with handling chinese named...  
Subject:Problem with handling chinese named...
Summary:rename() or fwrite() have errors with chinese named files
Messages:4
Author:jonas abesamis
Date:2009-08-11 13:25:30
Update:2009-08-20 19:38:55
 

  1. Problem with handling chinese named...   Reply   Report abuse  
Picture of jonas abesamis jonas abesamis - 2009-08-11 19:31:23
Hello guys I hope you can help me with this one.
*note: create a blank file named work.html before running my code*

Using rename(),copy() or fwrite() I get an error or weird results.

When Im trying to rename an english file, for example "work.html" to a files with chinese characters, I get a file named "指南.html" instead.

Here is my code:

<?
ini_set('default_charset', 'UTF-8');
$opts = array(
'http'=>array(
//'method'=>"GET",
'header'=>"default_charset = UTF-8"
)
);
$context = stream_context_create($opts);

$xslt_result = "&#25351;&#21335;";

$work = html_entity_decode($xslt_result, ENT_NOQUOTES,'UTF-8');
print $work.".html should be the resulting file";

rename("work.html", $work.".html",$context);
?>

When I try to use the copy() function I get an error instead. Im using windows vista with XAMPP.
I hope someone can help me with this. I would greatly appreciate it.

There are 3 replies in this thread, which are not being displayed.
Browsing this forum thread replies is available only to premium subscribers.


Go to the premium subscriptions page to learn how to become a premium subscriber and have full access to this forum.