From 053c9074f897dade3030e98464da10a232a05fb6 Mon Sep 17 00:00:00 2001 From: Marco Dickert Date: Mon, 31 Jul 2017 16:29:28 +0200 Subject: [PATCH] fixed error when encoding the json response --- build/libifm.php | 3 ++- ifm.php | 3 ++- src/main.php | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/build/libifm.php b/build/libifm.php index 061fa74..234352c 100644 --- a/build/libifm.php +++ b/build/libifm.php @@ -2957,7 +2957,8 @@ function IFM( params ) { array( $this, 'convertToUTF8' ) ); else - $item = utf8_encode( $item ); + if( function_exists( "mb_check_encoding" ) && ! mb_check_encoding( $item, "UTF-8" ) ) + $item = utf8_encode( $item ); } public function checkAuth() { diff --git a/ifm.php b/ifm.php index 812b58f..35cd228 100644 --- a/ifm.php +++ b/ifm.php @@ -2957,7 +2957,8 @@ function IFM( params ) { array( $this, 'convertToUTF8' ) ); else - $item = utf8_encode( $item ); + if( function_exists( "mb_check_encoding" ) && ! mb_check_encoding( $item, "UTF-8" ) ) + $item = utf8_encode( $item ); } public function checkAuth() { diff --git a/src/main.php b/src/main.php index 73ecc0b..620fc05 100644 --- a/src/main.php +++ b/src/main.php @@ -886,7 +886,8 @@ f00bar; array( $this, 'convertToUTF8' ) ); else - $item = utf8_encode( $item ); + if( function_exists( "mb_check_encoding" ) && ! mb_check_encoding( $item, "UTF-8" ) ) + $item = utf8_encode( $item ); } public function checkAuth() {