使用utf8mb4的PHP / mysql站点不能正确地从数据库中检索表情符号,尽管在任何地方都指定了utf8mb4,我可以找到它来放置它

I converted my mysql 5.7 database to utf8mb4 today.

As a test, I've put a poo emoji (

The problem was an outdated version of Navicat. Upgrading from 8 to 11 has fixed my issues. I realised this was probably the cause when I discovered that emojis INSERTed via php were correctly stored and retrieved in PHP, but wouldn't show correctly in Navicat.

Similarly the opposite was true; emojis set in Navicat would correctly store and retrieve in Navicat, but not in PHP.

Looking at the encoding options for navicat connections, it had a checkbox for "use mysql encoding", but if left unchecked the dropdown of possible options included only utf8, not utf8mb4. I guess navicat 8 pre-dates that being in common usage.

A quick upgrade, and everything works perfectly.