2

I am using php 7.0. To make the site fully utf-8 compatible, there are many steps we have to take as explained here.

I have doubt about mbstring encoding. The following is the ideal mbstring settings, as I understand, to be placed at beginning of the php script. (source)

//setup php for working with Unicode data
mb_internal_encoding('UTF-8');
mb_http_output('UTF-8');
mb_http_input('UTF-8');
mb_language('uni');
mb_regex_encoding('UTF-8');
ob_start('mb_output_handler');

I have gone through each of the settings. So my understanding is that just use default_charset="UTF-8" and no need to use explicit mbstring settings I explained above because mbstring settings take value from default_charset (source).

Please tell whether I am right in this.

Funk Forty Niner
  • 74,450
  • 15
  • 68
  • 141
Kiran
  • 896
  • 1
  • 6
  • 25
  • 1
    Working with UTF8 can be a bit tricky sometimes and it's not always an exact science, especially when it comes to user input, databases and files. `mb_*` may not always produce the desired results (least, in some of the things I have encountered when working with all of those). Just setting a default charset may not always be enough. If something breaks, comment those out and try another method. All that you can do is try them out. – Funk Forty Niner Jan 02 '18 at 13:37
  • 2
    You may have missed one point: To work with UTF-8 all the elements involved need to work with UTF-8. So yes, PHP needs to process text strings as UTF-8, but also the browser on the client side, the connection to the database, the database itself, and so on. PHP is just a link in a, sometimes long, chain. – KIKO Software Jan 02 '18 at 13:51
  • @KIKOSoftware, i have taken care of all settings given at https://stackoverflow.com/questions/279170/utf-8-all-the-way-through. this is the only pending thing for me – Kiran Jan 02 '18 at 13:57

0 Answers0