简体   繁体   中英

Problems with ASCII encoded string - PHP

I'm parsing a page using php cURL and slicing data using DOMDocument() function. Parsed page has "UTF-8" encoding. Then i write data to database. But instead of

музыка

it is writing ASCII codes like this:

Музыка

I've tried iconv(), mb_convert_encoding(), utf8_encode, but still get the same. strlen() return the length of the coded string.

How to encode this to normal text?

<?php
$string ="&#1052;&#1091;&#1079;&#1099;&#1082;&#1072;";

echo html_entity_decode($string, ENT_NOQUOTES, 'UTF-8');

prints:

Музыка

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM