summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--php/FlatbufferBuilder.php4
1 files changed, 4 insertions, 0 deletions
diff --git a/php/FlatbufferBuilder.php b/php/FlatbufferBuilder.php
index 6f0ee483..5c18bf46 100644
--- a/php/FlatbufferBuilder.php
+++ b/php/FlatbufferBuilder.php
@@ -593,6 +593,10 @@ class FlatbufferBuilder
protected function is_utf8($bytes)
{
+ if (function_exists('mb_detect_encoding')) {
+ return (bool) mb_detect_encoding($bytes, 'UTF-8', true);
+ }
+
$len = strlen($bytes);
if ($len < 1) {
/* NOTE: always return 1 when passed string is null */