LoginSignup
5
5

More than 5 years have passed since last update.

UTF-8として妥当な文字列か1行でチェックする

Posted at
<?php
Zend\Stdlib\StringUtils::isValidUtf8($str);

ソース:https://github.com/zendframework/zf2/blob/master/library/Zend/Stdlib/StringUtils.php

ちなみに、u modifier使える環境かいなかの確認に、hasPcreUnicodeSupportメソッドがあります。

参照: PCREはUnicode文字プロパティをサポートするとは限らない - http://d.hatena.ne.jp/hnw/20090628

5
5
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5
5