I'm trying to read file line by line and keeping them in array. But I have Turkish chars in that file and I tried everything to fix that problem but no result.
The file has content like:
- Aksesuar ve Sarf / Pil / Taşınabilir Şarj Cihazı (PowerBank)
- Aksesuar ve Sarf / Pil / Çinko
- Aksesuar ve Sarf / Profesyonel Kaset /
You can see the Ş, ı chars. I see them as ? in array. What should I do?
Here is my code:
 public function getCategoriesByFile($fileUrl){
            $file = fopen($fileUrl,"r");
            $lines = array();
            $last = array();
            while(! feof($file))
              {
               $line= fgets($file);
              $line = $line; 
               array_push($lines , $line);
              }
            fclose($file);
            foreach($lines as $line){
                $parsedLines[] = preg_replace("/\s+/"," ",preg_split('/;/', trim($line)));
            }
            foreach($parsedLines as $parsed){
                $parse1 = rtrim($parsed[0] , " / ");
                $parse2 = rtrim($parsed[1] , " / ");
                array_push($last,array($parse1,$parse2));
            }
            return $last;
        }
the output like :
  }
  [2] => array(2) {
    [0] => string(64) "Aksesuar ve Sarf / Pil / Taşınabilir Åarj Cihazı (PowerBank)"
    [1] => string(0) ""
  }
  [3] => array(2) {
    [0] => string(31) "Aksesuar ve Sarf / Pil / Çinko"
    [1] => string(0) ""
Need your help guys. Thank you.
 
     
    