encoding - Solved : Powershell : How to convert "ISO" char to UTF8? -



encoding - Solved : Powershell : How to convert "ISO" char to UTF8? -

i utilize function download rss feeds write in excel file :

class="lang-powershell prettyprint-override">function get-rss { param ([string]$url) $results = @() $wc = new-object net.webclient $wc.encoding = [system.text.encoding]::utf8 [xml]$resp = $wc.downloadstring("$url") $article = $resp.rss.channel.item foreach ($in in $article) { [string]$description = $in.description.innertext -replace "<.*?>" $results += set-news -title $in.title -content $description -publishdate $in.pubdate -link $in.origlink } homecoming $results

}

download work correctly have problem specific chars :

&#8230 ; &#8217 ; ...

i see in excel, how can convert see char behind code ?

best regards, robert

you need decode html characters. alter

class="lang-powershell prettyprint-override">[xml]$resp = $wc.downloadstring("$url")

to

class="lang-powershell prettyprint-override">[xml]$resp = [system.web.httputility]::htmldecode($wc.downloadstring("$url"))

if using ps2 add together add-type -assemblyname system.web @ top of script/function import required .net binary.

powershell encoding utf-8

Comments

Popular posts from this blog

model view controller - MVC Rails Planning -

ruby on rails - Devise Logout Error in RoR -

html - Submenu setup with jquery and effect 'fold' -