Hamihamidd
Hamihamidd

Reputation: 39

how to deal with non-latin character in <?php echo $img->

i have the following php code not returned images containing non-latin character,because their links show weird address.

if($image) {
   var_dump(mb_detect_encoding($image, 'UTF-8', true))
  $doc = new DOMDocument();
  $doc->loadHTML($image);
  $imgs = $doc->getElementsByTagName('img');
  foreach ($imgs as $img) { ?>
    <img data-src="<?php echo $img->getAttribute("src");?>" class="something"/>
  <?php }
} ?>

already i have <meta charset="utf-8">in <head>.how should i deal with this problem.

Upvotes: 1

Views: 189

Answers (0)

Related Questions