google merchant center special chars issue

I have product feed like that

<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:g="http://base.google.com/ns/1.0" version="2.0">
  <channel>
    <name>name</name>
    <description>description</description>
    <link>link</link>
    <item>
      <g:id>27</g:id>
      <g:title>title</g:title>
      <g:description>description</g:description>
      <g:link>link</g:link>
      <g:image_link>image_link</g:image_link>
      <g:availability>in_stock</g:availability>
      <g:condition>new</g:condition>
      <g:price>price</g:price>
      <g:brand>brand</g:brand>
      <g:gtin>gtin</g:gtin>
    </item>
  </channel>
</rss>

generated by php

        $dom = new DOMDocument();
        $dom->encoding = 'utf-8';
        $dom->xmlVersion = '1.0';
        $dom->formatOutput = true;
        $root = $dom->createElement('rss');
        $channel = $dom->createElement('channel');

//adding products

$root->setAttribute('xmlns:g', "http://base.google.com/ns/1.0");
        $root->setAttribute('version', "2.0");
        $root->appendChild($channel);

        $dom->appendChild($root);
        $dom->save($file_name);

        
        $xml = file_get_contents($file_name);
        $xml = trim($xml);
        header('Content-Type: text/xml');
        print($xml);

field ‘g:description’ may contain symbols like &Eacute; &mdash; &rsquo; &reg;
and when GMS tries to process the feed, I get an error “Error parsing/validating XML feed”
but &lt;p&gt; &nbsp; does not cause an error

How can i fix it?

I tried to set the encoding manually to UTF-8 in the GMS feed tab settings but it got worse