Исправлена обработка разметки с кодировкой windows-1251
This commit is contained in:
@ -26,8 +26,16 @@ class ContingentParser
|
||||
public function __construct(string $html, string $template)
|
||||
{
|
||||
libxml_use_internal_errors(true);
|
||||
$dom = new \DOMDocument();
|
||||
$dom->loadHTML(mb_convert_encoding($html,'HTML-ENTITIES','UTF-8'));
|
||||
$dom = new \DOMDocument(
|
||||
encoding: "UTF-8"
|
||||
);
|
||||
$html = mb_convert_encoding(
|
||||
$html,
|
||||
'UTF-8',
|
||||
mb_detect_encoding($html, 'UTF-8, windows-1251')
|
||||
);
|
||||
$html = str_replace('windows-1251','utf-8', $html);
|
||||
$dom->loadHTML($html);
|
||||
$this->xpath = new \DOMXPath($dom);
|
||||
$this->template = $template;
|
||||
}
|
||||
@ -52,7 +60,8 @@ class ContingentParser
|
||||
{
|
||||
$data = $this->parse();
|
||||
$records = array();
|
||||
|
||||
// var_dump($data);
|
||||
// exit(0);
|
||||
if ($data == null) return [];
|
||||
|
||||
$equal = $data['eduName']->length;
|
||||
|
Reference in New Issue
Block a user