From: nikitin at freshframes dot com Operating system: debian 4.0 PHP version: 5.2.6 PHP Bug Type: Filesystem function related Bug description: translation mixup
Description: ------------ i upload a latin1 file to the debian server (move_uploaded_file) this file is stored in utf8 (using utf8 translation in putty shows me correct chars, using latin1 translation shows me the multibyte chars...) then i read the file into a var via file_get_contents and wonder why mb_check_encoding( var, "UTF-8" ) returns false. sending the var via browser to client with utf8 charset produces wrong data, so i probably have latin1 data in my var. now i use utf8_encode( var ) and everything works fine. what do i need to set to get utf8 data from file reads, or why do i need to encode it again? Reproduce code: --------------- move_uploaded_file( $_FILES['file']['tmp_name'][0], $file ); $data = file_get_contents( $file ); var_dump( array( mb_check_encoding( $data, "UTF-8" ), mb_check_encoding( utf8_encode( $data ), "UTF-8" ) ); Expected result: ---------------- [ true, true ] Actual result: -------------- [ false, true ] -- Edit bug report at http://bugs.php.net/?id=46370&edit=1 -- Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=46370&r=trysnapshot52 Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=46370&r=trysnapshot53 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=46370&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=46370&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=46370&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=46370&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=46370&r=needscript Try newer version: http://bugs.php.net/fix.php?id=46370&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=46370&r=support Expected behavior: http://bugs.php.net/fix.php?id=46370&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=46370&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=46370&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=46370&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=46370&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=46370&r=dst IIS Stability: http://bugs.php.net/fix.php?id=46370&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=46370&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=46370&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=46370&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=46370&r=mysqlcfg