Using Unicode with PHP

How to use Unicode with PHP ?

I want to save a Unicode value in a PHP variable but displays some question marks .

What is a solution ?

+4
source share
3 answers

This is what you will need to do correctly, but here are two links that you should start with: Character Sets / Character Encoding UTF-8 Processing with PHP

+3
source

In php.ini:

  default_charset = "UTF-8"
 mbstring.internal_encoding = "UTF-8"

 ;  overload (replace) single byte functions by mbstring functions.
 ;  mail (), ereg (), etc are overloaded by mb_send_mail (), mb_ereg (),
 ;  etc.  Possible values ​​are 0,1,2,4 or combination of them.
 ;  For example, 7 for overload everything.
 ;  0: No overload
 ;  1: Overload mail () function
 ;  2: Overload str * () functions
 ;  4: Overload ereg * () functions
 mbstring.func_overload = 4
+8
source

make sure your output encoding is utf8

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

PS agrees with some answers.

+4
source

Source: https://habr.com/ru/post/1300771/


All Articles