ConvertTo-HTML

Microsoft Windows
Post Reply
User avatar
MigrationUser
Posts: 336
Joined: 2021-Jul-12, 1:37 pm
Contact:

ConvertTo-HTML

Post by MigrationUser »

01 May 2009 21:54
arenas


heya :)

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 :(
Le réseau de transports de st-innsbruck a été amélioré.

how i have to do?

tnx for any help :)
arenas

----------------------------

#2 02 May 2009 19:59
Simon Sheppard


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

----------------------------

#02 May 2009 20:52
arenas


heya Simon :)

many tnx for your help !

arenas

----------------------------

#4 04 May 2009 08:28
arenas


hi Simon :)

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

----------------------------

#04 May 2009 13:29
Simon Sheppard


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")

----------------------------

#6 04 May 2009 21:30
arenas
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 :)

many tnx now all is right for me !

arenas

----------------------------

#09 May 2009 12:28
arenas

Code: Select all

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 :)

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 :(

I have en ander problem.

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:

Code: Select all

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

----------------------------

#27 May 2009 15:14
arenas


hi :)

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)

----------------------------

# 02 Nov 2009 22:07
arenas


hello @ll :)

geocities is clos!

all my page you can find now at :

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

gl
Post Reply