Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > PowerShell

Vista - Standard output encoding

Reply
 
Old 07-22-2007   #1 (permalink)
harti


 
 

Standard output encoding

Hi,

I want to use a powershell script for CGI. Naturally for this I need the
output to be in ASCII. It seems like out-file -encoding ascii doesn't help
here, because there is no /dev/stdout that I would use in unix (or is
there?). out-host, out-* on the other hand is missing the -encoding option.
Obviously I'm missing something... Any hint?

harti

My System SpecsSystem Spec
Old 07-22-2007   #2 (permalink)
RichS


 
 

RE: Standard output encoding

If you want the file to contain ASCII encoded data then I think you need to
use out-file as you describe. What exactly are you trying to accomplish?
Are you producing a file to be read by a unix system?

This article regarding files produced by powershell and then being read by
VBScript may help

http://richardsiddaway.spaces.live.c...3E96!175.entry

--
Richard Siddaway
Please note that all scripts are supplied "as is" and with no warranty
Blog: http://richardsiddaway.spaces.live.com/
PowerShell User Group: http://www.get-psuguk.org.uk


"harti" wrote:

> Hi,
>
> I want to use a powershell script for CGI. Naturally for this I need the
> output to be in ASCII. It seems like out-file -encoding ascii doesn't help
> here, because there is no /dev/stdout that I would use in unix (or is
> there?). out-host, out-* on the other hand is missing the -encoding option.
> Obviously I'm missing something... Any hint?
>
> harti

My System SpecsSystem Spec
Old 07-22-2007   #3 (permalink)
harti


 
 

RE: Standard output encoding



"RichS" wrote:

> If you want the file to contain ASCII encoded data then I think you need to
> use out-file as you describe. What exactly are you trying to accomplish?
> Are you producing a file to be read by a unix system?


I need the standard output to be ASCII. That is what IIS or Apache expect.
So out-file doesn't help, because I have no filename to specify.

harti

My System SpecsSystem Spec
Old 07-22-2007   #4 (permalink)
RichS


 
 

RE: Standard output encoding

Could you use the WSH COM objects in your script to pass the data across to
IIS?


--
Richard Siddaway
Please note that all scripts are supplied "as is" and with no warranty
Blog: http://richardsiddaway.spaces.live.com/
PowerShell User Group: http://www.get-psuguk.org.uk


"harti" wrote:

>
>
> "RichS" wrote:
>
> > If you want the file to contain ASCII encoded data then I think you need to
> > use out-file as you describe. What exactly are you trying to accomplish?
> > Are you producing a file to be read by a unix system?

>
> I need the standard output to be ASCII. That is what IIS or Apache expect.
> So out-file doesn't help, because I have no filename to specify.
>
> harti
>

My System SpecsSystem Spec
Old 07-23-2007   #5 (permalink)
Nigel Sharples


 
 

Re: Standard output encoding

You can use the $OutputEncoding variable to set the encoding for input to
native applications:

PS> $OutputEncoding = [Text.Encoding]::ASCII

Here's a blog entry that describes OutputEncoding a bit more:
http://blogs.msdn.com/powershell/arc...he-rescue.aspx

--
Nigel Sharples [MSFT]
Windows PowerShell
Microsoft Corporation
This posting is provided "AS IS" with no warranties, and confers no rights.

"harti" <harti@discussions.microsoft.com> wrote in message
news:904B94E2-9F77-421D-B738-E12772D659FC@microsoft.com...
> Hi,
>
> I want to use a powershell script for CGI. Naturally for this I need the
> output to be in ASCII. It seems like out-file -encoding ascii doesn't help
> here, because there is no /dev/stdout that I would use in unix (or is
> there?). out-host, out-* on the other hand is missing the -encoding
> option.
> Obviously I'm missing something... Any hint?
>
> harti


My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
Add-Content -Encoding UTF8 and -Encoding Unicode Powershell bugs PowerShell
Standard output redirecting PowerShell
encoding Vista mail
Standard output and standard error merging to a log file PowerShell
Redirection of standard out and standard error PowerShell


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46