Read Persian (Unicode chars) text file using php

后端 未结 3 2033
忘掉有多难
忘掉有多难 2021-01-22 02:12

I am reading one Persian text file (using PHP) with the help of below code:

/* Reading the file name and the book (UTF-8) */
if(file_exists($SourceDirectoryFile)         


        
3条回答
  •  感动是毒
    2021-01-22 02:34

    final and best solution is this: use this line under your connect

    mysqli_set_charset( $con, 'utf8');
    

    like this:

    $con = mysqli_connect("localhost","root","amirahmad","shoutit");
    mysqli_set_charset( $con, 'utf8');
    

    and at the end add this line right under the head tag in your html to make sure your page have utf-8 charset,like this:

    
        
    

    and that's it . you can read formal document here : pph.net charset

提交回复
热议问题