shedokan Posted December 6, 2007 Share Posted December 6, 2007 is there a way to create a .inc utf-8 file? I tried but all I get is: ×××××××××××××× Link to comment https://forums.phpfreaks.com/topic/80495-solved-how-can-i-create-a-utf-8-file/ Share on other sites More sharing options...
effigy Posted December 6, 2007 Share Posted December 6, 2007 I think so. How are you creating and saving the file? Link to comment https://forums.phpfreaks.com/topic/80495-solved-how-can-i-create-a-utf-8-file/#findComment-408098 Share on other sites More sharing options...
shedokan Posted December 6, 2007 Author Share Posted December 6, 2007 function writeGuide($id, $text){ $f = fopen($id.".inc", "wb"); $text = utf8_encode($text); $text = "\xEF\xBB\xBF".$text; fwrite($f, $text); fclose($f); } Link to comment https://forums.phpfreaks.com/topic/80495-solved-how-can-i-create-a-utf-8-file/#findComment-408127 Share on other sites More sharing options...
shedokan Posted December 6, 2007 Author Share Posted December 6, 2007 please. Link to comment https://forums.phpfreaks.com/topic/80495-solved-how-can-i-create-a-utf-8-file/#findComment-408199 Share on other sites More sharing options...
effigy Posted December 6, 2007 Share Posted December 6, 2007 What is being passed to the function? What's in $text after the encode? Link to comment https://forums.phpfreaks.com/topic/80495-solved-how-can-i-create-a-utf-8-file/#findComment-408235 Share on other sites More sharing options...
shedokan Posted December 6, 2007 Author Share Posted December 6, 2007 $text is a utf-8 text Link to comment https://forums.phpfreaks.com/topic/80495-solved-how-can-i-create-a-utf-8-file/#findComment-408250 Share on other sites More sharing options...
shedokan Posted December 7, 2007 Author Share Posted December 7, 2007 please. Link to comment https://forums.phpfreaks.com/topic/80495-solved-how-can-i-create-a-utf-8-file/#findComment-408722 Share on other sites More sharing options...
~n[EO]n~ Posted December 7, 2007 Share Posted December 7, 2007 Try like this, keeping utf8_encode function inside fwrite parameter, not too sure <?php function writeGuide($id, $text) { $f = fopen($id.".inc", "wb"); $text = "\xEF\xBB\xBF".$text; fwrite($f, utf8_encode($text)); fclose($f); } ?> Link to comment https://forums.phpfreaks.com/topic/80495-solved-how-can-i-create-a-utf-8-file/#findComment-408734 Share on other sites More sharing options...
shedokan Posted December 7, 2007 Author Share Posted December 7, 2007 nope now I just get different characters. Link to comment https://forums.phpfreaks.com/topic/80495-solved-how-can-i-create-a-utf-8-file/#findComment-408900 Share on other sites More sharing options...
shedokan Posted December 7, 2007 Author Share Posted December 7, 2007 please. I know that almost all of you use fopen()! Link to comment https://forums.phpfreaks.com/topic/80495-solved-how-can-i-create-a-utf-8-file/#findComment-408954 Share on other sites More sharing options...
shedokan Posted December 7, 2007 Author Share Posted December 7, 2007 *bump* Link to comment https://forums.phpfreaks.com/topic/80495-solved-how-can-i-create-a-utf-8-file/#findComment-409182 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.