Page 1 of 1

how to create utf-8 unicodeded txt file with php?

Posted: Tue Jan 16, 2007 1:12 am
by ddragas
how to create utf-8 unicodeded txt file with php?

Posted: Tue Jan 16, 2007 2:08 am
by gunman
Use

Code: Select all

<?
header("Content-type: text/plain;charset=utf-8 \r\n");
header("Content-Disposition: attachment; filename=text.txt");
echo "text file content";
?>

Posted: Tue Jan 16, 2007 3:12 pm
by feyd
For many utf-8 compatible readers, it may need a byte-order marker (BOM) as well.

Posted: Tue Jan 16, 2007 4:17 pm
by Kieran Huggins
also take a look at http://www.php.net/manual/en/ref.mbstring.php

There's no sense in sending a UTF-8 doc if it's not full of UTF-8 content ;-)

Posted: Wed Jan 17, 2007 1:15 pm
by ddragas
thank you all folks for reply

problem is solved !! :D :D :D

Posted: Wed Jan 17, 2007 3:20 pm
by Ollie Saunders
\r\n
You don't need that in the header function.