PHP print() Arabic string

后端 未结 5 1674
无人共我
无人共我 2021-01-20 05:32

When I try and execute this code to print out an Arabic string: print(\"إضافة\"); I get this output: إضاÙØ©. If I utf8_decode() it I\'ll get <

5条回答
  •  时光说笑
    2021-01-20 05:39

    Well,

    First: Add by the beginning of HTML page

    
    

    second: if you are using AJAX encode data using encodeURIComponent

    Third: First line of your PHP page should be

    header('Content-Type: text/html; charset=utf-8'); 
    

    and decode the data sent to PHP using urldecode

    Regards,

提交回复
热议问题