How to check if multi-byte string is valid for a specified encoding in PHP

1 Answer

0 votes
$s = "לתכנות עדיין יצטרכו בני אדם בעתיד";

if ( mb_check_encoding ( $s, 'UTF-8' ) === true)
    echo "UTF-8";
if ( mb_check_encoding ( $s, 'UTF-32' ) === true)
    echo "UTF-32";
 

// use only function that start with: 'mb_' ('mb_' prefix)

/*
run:

UTF-8

*/

 



answered Aug 11, 2015 by avibootz

Related questions

1 answer 179 views
2 answers 249 views
1 answer 167 views
2 answers 222 views
222 views asked Aug 10, 2015 by avibootz
...