Why Cyrillic kicks asJson and asXml?

$data = ["id" => 10, "text" => 'Hi'];
return $this->asXml($data);


Change "Hi" to "hi", get
This page contains the following errors:
error on line 37 at column 2: Encoding error
Below is a rendering of the page up to the first error.

Page contains
<?xml version="1.0" encoding="UTF-8"?>

If "Hi" returns so
<?xml version="1.0" encoding="UTF-8"?>

If the change on asJson, "Hi" gives

and "hi" gives
путь...\\vendor\\yiisoft\\yii2\\helpers\\BaseJson.php(62): yii\\helpers\\BaseJson::handleJsonError(4)","#1 [internal function]: yii\\helpers\\Json::yii\\helpers\\{closure}(2, 'json_encode(): ...', 'the path...', 64, Array)","#2 
путь...\\vendor\\yiisoft\\yii2\\helpers\\BaseJson.php(64): json_encode(Array, 320)","#3 
путь...\\vendor\\yiisoft\\yii2\\web\\JsonResponseFormatter.php(89): yii\\helpers\\BaseJson::encode(Array, 320 путь...\\vendor\\yiisoft\\yii2\\web\\JsonResponseFormatter.php(73): yii\\web\\JsonResponseFormatter->formatJson(Object(yii\\web\\Response)
путь...\\vendor\\yiisoft\\yii2\\web\\Response.php(1041): yii\\web\\JsonResponseFormatter->format(Object(yii\\web\\Response)
путь...\\vendor\\yiisoft\\yii2\\web\\Response.php(337): yii\\web\\Response->prepare(
путь...\\vendor\\yiisoft\\yii2\\base\\Application.php(392): yii\\web\\Response->send(
путь...\\app\\web\\index.php(17): yii\\base\\Application->run()","#9 {main}"]}
June 9th 19 at 00:47
2 answers
June 9th 19 at 00:49
Probably the thing $this->asXml($data), and that there only you know
In question all laid out. - Clifton.Treut commented on June 9th 19 at 00:52
That all? See that in this function, debate where the error in the methods
You can do 1251 transfer - Mabel commented on June 9th 19 at 00:55
How it works
$data = ["id" => 10, "text" => 'Hi'];
return $this->asXml($data);

Doesn't work
$data = ["id" => 10, "text" => 'Hello'];
return $this->asXml($data); - Clifton.Treut commented on June 9th 19 at 00:58
That's not all. This is the first entry that caused the error. Go in and see the asXml method that there is and the list goes on - Mabel commented on June 9th 19 at 01:01
What is the file encoding? to set utf-8 without bom
Here it must be the encoding, because if you look at the source code for yii\helpers\BaseJson exception of type yii\base\InvalidParamException it is forwarding in case the code is not possible to encode or decode a string - adell17 commented on June 9th 19 at 01:04
June 9th 19 at 00:51
This page contains the following errors:

This text is similar to display error or validation xml in the browser.
Press Ctrl+U and look at your page source
Yes, it is a validation error. The source code of the page is laid out. - Clifton.Treut commented on June 9th 19 at 00:54

Find more questions by tags Yii