#1 01 May 2009 21:54

arenas
Member
Registered: 01 May 2009
Posts: 11

ConvertTo-HTML

heya smile

pls i need encoding UTF7

my script is okay with UTF8:

$blog.rss.channel.item | Select-Object date, title -first 9 | ConvertTo-HTML | Out-File C:\MvMaVille_Rss_Feed.html

but the result is so bad : sad
Le réseau de transports de st-innsbruck a été amélioré.

how i have to do?

tnx for any help smile
arenas

Offline

#2 02 May 2009 19:59

Simon Sheppard
Super Administrator
Registered: 27 Aug 2005
Posts: 997
Website

Re: ConvertTo-HTML

To choose the encoding: Out-File -encoding

       The character encoding used in the file.
       "Unicode", "UTF7", "UTF8", "UTF32", "ASCII", "BigEndianUnicode",
       "Default", or "OEM". The default is Unicode.
       Default=system ANSI code page.
       OEM=OEM code page identifier for the OS.

e.g.
Out-File -encoding UTF7 C:\MvMaVille_Rss_Feed.html

Offline

#3 02 May 2009 20:52

arenas
Member
Registered: 01 May 2009
Posts: 11

Re: ConvertTo-HTML

heya Simon smile

many tnx for your help !

arenas

Offline

#4 04 May 2009 08:28

arenas
Member
Registered: 01 May 2009
Posts: 11

Re: ConvertTo-HTML

hi Simon smile

i m so sorry but i dont get any good resultat sad

my script is :
#cls
#$rssUrl = "http://st-innsbruck.miniville.fr/rss"
#$blog = [xml](new-object System.Net.WebClient).DownloadString($rssUrl)
#$blog.rss.channel.item | Select-Object date, title -first 9 | ConvertTo-HTML | Out-File -encoding UTF7 C:\MvMaVille_Rss_Feed.html

i analys inside the html-page :
#<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" #"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
#<html lang="fr" xml:lang="fr">  <===== ???????
# ./......
pls, wath you can do?

many tnx
arenas

Offline

#5 04 May 2009 13:29

Simon Sheppard
Super Administrator
Registered: 27 Aug 2005
Posts: 997
Website

Re: ConvertTo-HTML

Ah sorry I think you need to set the encoding first - try this


$rssUrl = "http://st-innsbruck.miniville.fr/rss"

$WebClient = New-Object System.Net.WebClient
$WebClient.Encoding = [System.Text.Encoding]::UTF8
$WebClient.DownloadFile($rssUrl, "c:\MvMaVille_Rss_Feed.html")

Offline

#6 04 May 2009 21:30

arenas
Member
Registered: 01 May 2009
Posts: 11

Re: ConvertTo-HTML

Simon Sheppard wrote:

Ah sorry I think you need to set the encoding first - try this


$rssUrl = "http://st-innsbruck.miniville.fr/rss"

$WebClient = New-Object System.Net.WebClient
$WebClient.Encoding = [System.Text.Encoding]::UTF8
$WebClient.DownloadFile($rssUrl, "c:\MvMaVille_Rss_Feed.html")

hello Simon smile

many tnx now all is rigth for me !

arenas

Offline

#7 09 May 2009 12:28

arenas
Member
Registered: 01 May 2009
Posts: 11

Re: ConvertTo-HTML

Simon Sheppard wrote:

Ah sorry I think you need to set the encoding first - try this
$rssUrl = "http://st-innsbruck.miniville.fr/rss"
$WebClient = New-Object System.Net.WebClient
$WebClient.Encoding = [System.Text.Encoding]::UTF8
$WebClient.DownloadFile($rssUrl, "c:\MvMaVille_Rss_Feed.html")

Heya Sir Simon smile

i have save also the file as TXT:
and on the top is :

<?xml version='1.0' encoding='UTF-8'?>
<rss xmlns:dc="http://purl.org/dc/elements/1.1" version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/">
<channel>
    <title>st-innsbruck</title>
    <link>http://st-innsbruck.miniville.fr/</link>
    <description>237899 habitants</description>
    <generator>miniville</generator>
    <language></language>
./..

Pls., So i need in order the channel items to use the expressions:
"title"=H1 "Les derniers événements :" + "title",
"description" = h2 "Populations :" + "description",
"generator" = h3 "Type de la Ville " + "generator" ! on the header.

i dont have find out sad

I have en ander probleme.

how i have to use ECHO ON/ECHO OFF ?
i would trace my script to see the variable wath she do.
i use ISE. (poor and barbare)
=============

Many thx Simon
arenas

=============
p.s.
the last script is now:

cls

# Style/Habiage (colorée....)

$a = "<style>"
$a = $a + "BODY{
    background-color: #bcd7fe;
    font-family: Arial, Helvetica, sans-serif;
}"
$a = $a + "TABLE{
    border-width: 1px;
    border-style: solid;
    border-color: #457dcf;
    border-collapse: collapse;
}"
$a = $a + "TH{
    border-width: 1px;
    padding: 10px;
    border-style: solid;
    border-color: #457dcf;
    background-color: #457dcf;
    font-family: arial,sans-sherif;
    color: #deecfe;
    font-size: small;
}"
$a = $a + "TD{
    border-width: 1px;
    padding: 3px;
    border-style: solid;
    border-color: #457dcf;
    background-color: #deecfe;
    font-family: Arial, Helvetica, sans-serif;
    color: #457dcf;
    font-size: smaller;
}"
$a = $a + "H2{
    color: #457dcf;
    font-family: Arial, Helvetica, sans-serif;
    font-size: medium;
    margin-left: 40px;
}"
$a = $a + "h1{
    color:#457dcf;
    font-family:Arial, Helvetica, sans-serif;
    font-size:medium;
    margin-left: 40px;
}"
$a = $a + "</style>"

# Utiliser l'url

$rssUrl = "http://st-innsbruck.miniville.fr/rss"
$WebClient = New-Object System.Net.WebClient
$WebClient.Encoding = [System.Text.Encoding]::UTF8
$blog = [xml]$WebClient.DownloadString($rssUrl)

# Save to / Sauvgarde en format Html

$blog.rss.channel.item | Select-object | select @{name="Dernière édition dates/heures :";expression={$_.pubDate;}}, @{name="Evénements :";expression={$_.title}} -first 9 | ConvertTo-HTML -head $a –body "<H1><p>Les derniers événements</p></H1><h2><p>Populations : ????</p></h2>" | Out-File C:\MMV_Rss_Feed_st-innsbruck.html

but i have dont find en solution for the header H1/h2/h3 sad

Offline

#8 27 May 2009 15:14

arenas
Member
Registered: 01 May 2009
Posts: 11

Re: ConvertTo-HTML

hi smile

this is my last up-date.

http://de.geocities.com/arnold_at_home/ … Dcity.html

arenas

Last edited by arenas (15 Jun 2009 14:12)

Offline

#9 02 Nov 2009 22:07

arenas
Member
Registered: 01 May 2009
Posts: 11

Re: ConvertTo-HTML

hello @ll smile

geocities is clos!

all my page you can find now at :

http://pagesperso-orange.fr/arenas/3D/stats3D-City.html

gl

Offline

Board footer

Powered by FluxBB