Preg_Replace and UTF8

后端 未结 3 992
清酒与你
清酒与你 2021-01-05 22:55

I\'m enhancing our video search page to highlight the search term(s) in the results. Because user can enter judas priest and a video has Judas Priest

3条回答
  •  一个人的身影
    2021-01-05 23:53

    If I'm not mistaken, preg_match uses the current locale. Try setting the locale to the language which these characters belongs to. You probably need a utf8 based locale too. If you have mixed languages in your page, you may be able to find a generic international locale that works.

    See also: http://www.phpwact.org/php/i18n/utf-8

提交回复
热议问题