File tree Expand file tree Collapse file tree 3 files changed +23
-5
lines changed Expand file tree Collapse file tree 3 files changed +23
-5
lines changed Original file line number Diff line number Diff line change @@ -222,10 +222,7 @@ protected function _normalizeData( $data ) {
222
222
}
223
223
break ;
224
224
case 'string ' :
225
- // condition introduced for Issue with non-English text #240 where languages such as Hebrew get messed up.
226
- if ( function_exists ( 'mb_detect_encoding ' ) && mb_detect_encoding ( $ data [ $ i ] ) !== 'UTF-8 ' ) {
227
- $ data [ $ i ] = utf8_encode ( $ data [ $ i ] );
228
- }
225
+ $ data [ $ i ] = $ this ->toUTF8 ( $ data [ $ i ] );
229
226
break ;
230
227
}
231
228
}
@@ -234,4 +231,21 @@ protected function _normalizeData( $data ) {
234
231
return $ data ;
235
232
}
236
233
234
+
235
+ /**
236
+ * Converts values to UTF8, if required.
237
+ *
238
+ * @access protected
239
+ *
240
+ * @param string $datum The data to convert.
241
+ *
242
+ * @return string The converted data.
243
+ */
244
+ protected final function toUTF8 ( $ datum ) {
245
+ if ( ! function_exists ( 'mb_detect_encoding ' ) || mb_detect_encoding ( $ datum ) !== 'ASCII ' ) {
246
+ $ datum = \ForceUTF8 \Encoding::toUTF8 ( $ datum );
247
+ }
248
+ return $ datum ;
249
+ }
250
+
237
251
}
Original file line number Diff line number Diff line change @@ -83,6 +83,9 @@ private function _fetchSeries( &$handle ) {
83
83
84
84
for ( $ i = 0 , $ len = count ( $ labels ); $ i < $ len ; $ i ++ ) {
85
85
$ default_type = $ i == 0 ? 'string ' : 'number ' ;
86
+
87
+ $ labels [ $ i ] = $ this ->toUTF8 ( $ labels [ $ i ] );
88
+
86
89
$ this ->_series [] = array (
87
90
'label ' => $ labels [ $ i ],
88
91
'type ' => isset ( $ types [ $ i ] ) ? $ types [ $ i ] : $ default_type ,
Original file line number Diff line number Diff line change 23
23
"require" : {
24
24
"codeinwp/themeisle-sdk" : " master" ,
25
25
"xrstf/composer-php52" : " ^1.0.20" ,
26
- "PHPOffice/PHPExcel" : " ^1.8.1"
26
+ "PHPOffice/PHPExcel" : " ^1.8.1" ,
27
+ "neitanod/forceutf8" : " ~2.0"
27
28
},
28
29
"autoload" : {
29
30
"files" : [
You can’t perform that action at this time.
0 commit comments