简体   繁体   English

ASCII编码字符串的问题-PHP

[英]Problems with ASCII encoded string - PHP

I'm parsing a page using php cURL and slicing data using DOMDocument() function. 我正在使用php cURL解析页面,并使用DOMDocument()函数对数据进行切片。 Parsed page has "UTF-8" encoding. 解析的页面具有“ UTF-8”编码。 Then i write data to database. 然后我将数据写入数据库。 But instead of 但是代替

музыка

it is writing ASCII codes like this: 它正在编写这样的ASCII代码:

Музыка

I've tried iconv(), mb_convert_encoding(), utf8_encode, but still get the same. 我已经尝试过iconv(),mb_convert_encoding(),utf8_encode,但是仍然得到了相同的结果。 strlen() return the length of the coded string. strlen()返回编码字符串的长度。

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: 印刷品:

Музыка Музыка

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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