How to properly handle international character in PHP / MySQL / Apache

后端 未结 5 1898
我在风中等你
我在风中等你 2021-01-03 14:47

I need to create an application in PHP that can handle all Unicode characters in all places — edit fields, static HTML, database. Can somebody tell me the complete list of a

5条回答
  •  清歌不尽
    2021-01-03 15:29

    You were recommended to use either a HTTP header or a meta element to set the charset on your pages to utf-8. The W3C recommends that you do both. And the meta element should appear as early as possible on the page. (All characters before the meta element should be ASCII, which is basically identical in almost all character encodings. Some browsers will restart page rendering when they encounter the meta tag, which is another good reason to have it early.)

    Also, on all forms accepting user input put an accept-charset="utf-8" attribute. Generally browsers submitting POST data will default to the encoding of the page, but it's no harm to be sure.

提交回复
热议问题