We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 361092d commit 4c1213aCopy full SHA for 4c1213a
application/libraries/Format.php
@@ -227,8 +227,18 @@ public function to_json()
227
$callback = isset($_GET['callback']) ? $_GET['callback'] : '';
228
if ($callback === '')
229
{
230
- return json_encode($this->_data);
+ $str = $this->_data;
231
+ array_walk_recursive($str, function(&$item, $key)
232
+ {
233
+ if(!mb_detect_encoding($item, 'utf-8', true))
234
235
+ $item = utf8_encode($item);
236
+ }
237
+ });
238
+
239
+ return json_encode($str);
240
}
241
242
// we only honour jsonp callback which are valid javascript identifiers
243
else if (preg_match('/^[a-z_\$][a-z0-9\$_]*(\.[a-z_\$][a-z0-9\$_]*)*$/i', $callback))
244
0 commit comments