Check that `mb_detect_encoding()` exists too before using

See https://github.com/wp-cli/wp-cli/issues/1537