mb_strlen() is it enough? mb_strlen() is it enough? php php

mb_strlen() is it enough?


Correct

if (mb_strlen($name, 'UTF-8') < 3) is sufficient enough

make sure header is correct

HTTP-header (Content-Type: text/html; charset=UTF-8)

you can also check alternative for some reason

strlen(utf8_decode($string))

UTF-8 to Code Point Array Converter in PHP


In addition to JapanPro's answer:
Your HTML can have :

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

instead of an implicit header declaration:

HTTP-header (Content-Type: text/html; charset=UTF-8)