php - Whole RSS Feed from iso-8859-1 into UTF-8 -


i'm working on amazon echo skill, based on rss feed. feed encoded in iso-8859-1, needs in utf-8.

because skill needs <encoded> tag in case, tried:

$content = $xml->getelementsbytagname("encoded")                 ->item($i)->nodevalue; utf8_encode($content); 

but didn't anything. in header when load file via:

$file = 'old.xml';     $xml = new domdocument('1.0', 'utf-8');     $xml->load($file); 

it still says: <?xml version="1.0" encoding="iso-8859-1"?>

now can't find way solving problem. maybe change whole feed utf-8. ideas?

answer found. loaded feed with:

$feed = file_get_contents(' .... ');

and encoded with:

$feed = utf8_encode($feed);  $feed = str_replace('encoding="iso-8859-1"', 'encoding="utf-8"', $feed); 

now works fine me.

also changed load-function to:

$xml = new domdocument('1.0', 'utf-8'); $xml->loadxml($feed); 

Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

thorough guide for profiling racket code -