strpos()
works by counting a number of bytes; this is unreliable for UTF-8, so use mb_strpos()
for unicode stringsstrpos
with their multibyte versions. This it NOT RECOMMENDED as it can cause weird bugs, whether when switching hosts or when using 3rd-party code that wasn't written with this in mind.IntlChar::chr()
and IntlChar::isWhitespace
\u
escape for unicode code points in strings<meta charset="utf-8">
Content-Type: text/html; charset=utf-8
HTTP header<form enctype="text/plain; charset=utf-8">
latin1_swedish_ci
--bewareutf8mb4
supports the full range of UTF-8 characters (as people have discovered from trying to store emoji)varbinary
and blob
consume less space than utf8 varchar
, so they are useful in fields that users won't touch or whose contents never need to include special chars (e.g. URLs)
<meta>
and a Content-Type
header.
header()
must precede any echoed output. (Presence of a BOM can cause bugs here.)SET NAMES utf8
at the beginning of every connectionThank you, Michael Cullum for your excellent cat herding skills and work on @phpfig 3.0. A $50 Amazon gift card from Laracasts is on its way to you.
It's like Netflix for developers.
Thank you Dominic Bordelon for authoring the show notes for this episode!
If you'd like to contribute show notes and totally get credit for it, check out the show-notes repo!