Hi Pros,
I have a question regarding handling chinese character.
I have an text area for user to key in sth. But when the user key in Chinese Character and click a button[this button is for the user to save what he/she key in the textarea into their local directory].
The problem is when i view the file just save, all display funny symbol..
Can anyone tell me how to fix this problem i would sincerely appreciate?
Below is the php code i am using for the save button. I wonder if i want to fix this problem. how to start, is it because of my php script or html code....
I have a question regarding handling chinese character.
I have an text area for user to key in sth. But when the user key in Chinese Character and click a button[this button is for the user to save what he/she key in the textarea into their local directory].
The problem is when i view the file just save, all display funny symbol..
Can anyone tell me how to fix this problem i would sincerely appreciate?
Below is the php code i am using for the save button. I wonder if i want to fix this problem. how to start, is it because of my php script or html code....
Code:
<?php
// Check for user data, if its not empty do this...
if ( !empty( $_POST['FileContent'] ) )
{
// stripslash the user input
$string = stripslashes( $_POST["FileContent"] );
// Create a unique-ish filename.
$FileName = "Sitemaps.php";
// Create and open the file.
$FileHandle = fopen ( $FileName, 'w' );
// Write the data.
fwrite ( $FileHandle, $string );
// Close the file.
fclose ( $FileHandle );
// Set file header information.
header ( 'Content-Type: text/html' );
header ( 'Content-Description: File Transfer' );
header ( 'Content-Disposition: attachment; filename="' . basename( $FileName ) . '"' );
header ( 'Content-Length: ' . filesize( $FileName ) );
// Push file to client.
readfile( $FileName );
// Delete file.
unlink( $FileName );
exit();
}
?>
Comment