Skip to main content
Stack Overflow
  1. About
  2. For Teams

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

php write hebrew / UTF-8 in csv

Hi I am trying to write a CSV with HEBREW text in it. It writes some symbol not an Hebrew text. Below is my PHP CODE.

<?php
 $list = array (
 array('שלטל', 'שלטל', 'שלטל', 'שלטל'),
 array('123', '456', '789'),
 array('"שלטל"', '"שלטל"')
 );
 $fp = fopen('file.csv', 'w');
 //fputs($fp, $bom =( chr(0xEF) . chr(0xBB) . chr(0xBF) ));
 foreach ($list as $fields) {
 fputcsv($fp, $fields);
 }
 fclose($fp);
?>

I checked in internet and added "fputs($fp, $bom =( chr(0xEF) . chr(0xBB) . chr(0xBF) ))" but it didnt work out. Can some one help me.

Below is the out put i am getting.

enter image description here

Answer*

Draft saved
Draft discarded
Cancel
2
  • nope its not working with BOM.. I tried already.. Also i cant insist all users to user Nodepad++ because the default software they will have are ms-excell installed.. So I am looking for a solution to open it in msoffice .. Commented Jan 24, 2016 at 8:46
  • 1
    No need to insist user to use npp. I mentioned it so you can check it once using it. anyway, you found a solution! Way to go! Commented Jan 24, 2016 at 15:12

lang-php

AltStyle によって変換されたページ (->オリジナル) /