msinfo32 export is unicode vs ansi

J

jim

I am trying to use msinfo32 command lines to gather info
about our 100+ servers. I can get the text files out but
when I use Monarch to put the info into a table format I
have a problem. The problem comes down to the output of
msinfo32 being in unicode format and I need it to be in
ansi format. Is there an appropriate switch for msinfo32
or some other way of converting the output from a unicode
formatted text file to an ansi formatted text file?
 
T

Torgeir Bakken \(MVP\)

jim said:
I am trying to use msinfo32 command lines to gather info
about our 100+ servers. I can get the text files out but
when I use Monarch to put the info into a table format I
have a problem. The problem comes down to the output of
msinfo32 being in unicode format and I need it to be in
ansi format. Is there an appropriate switch for msinfo32
or some other way of converting the output from a unicode
formatted text file to an ansi formatted text file?
Hi

This will convert from unicode to ascii:

type log.unicode >log.ascii
 
M

Matthias Tacke

Torgeir Bakken \(MVP\) said:
Hi

This will convert from unicode to ascii:

type log.unicode >log.ascii
Hi Torgeir,
that doesn't meet my experience. I saved op's text with textpad as
unicode and see the output:
==screen=copy========================================================
C:\Test>type unicode.txt
a m t r y i n g t o u s e m s i n f o 3 2 c o m m a n d l i n e s t o g a t h e r i n f o
a b o u t o u r 1 0 0 + s e r v e r s . I c a n g e t t h e t e x t f i l e s o u t b u t
w h e n I u s e M o n a r c h t o p u t t h e i n f o i n t o a t a b l e f o r m a t I
h a v e a p r o b l e m . T h e p r o b l e m c o m e s d o w n t o t h e o u t p u t o f
m s i n f o 3 2 b e i n g i n u n i c o d e f o r m a t a n d I n e e d i t t o b e i n
a n s i f o r m a t . I s t h e r e a n a p p r o p r i a t e s w i t c h f o r m s i n f o 3 2
o r s o m e o t h e r w a y o f c o n v e r t i n g t h e o u t p u t f r o m a u n i c o d e
f o r m a t t e d t e x t f i l e t o a n a n s i f o r m a t t e d t e x t f i l e ?
C:\Test>more unicode.txt
I am trying to use msinfo32 command lines to gather info
about our 100+ servers. I can get the text files out but
when I use Monarch to put the info into a table format I
have a problem. The problem comes down to the output of
msinfo32 being in unicode format and I need it to be in
ansi format. Is there an appropriate switch for msinfo32
or some other way of converting the output from a unicode
formatted text file to an ansi formatted text file?

C:\Test>
==screen=copy=========================================================

So I recommend more for this task. If you want to convert the file you
might use a port of unix recode: http://recode.progiciels-bpi.ca/
 
G

Guest

That is all a bit over my head. Is there not a method where I can put it in
a batch file? I'm not a programmer just a network guy trying to do a job. I
have a batch file that will run msinfo32 for all my servers, which creates an
individual text file for each server with unicode formatting. Since I need
it to be ANSI formatting, I need a command line method to be able to save the
file with ANSI formatting.
 
M

Matthias Tacke

That is all a bit over my head. Is there not a method where I can put
it in a batch file? I'm not a programmer just a network guy trying to
do a job. I have a batch file that will run msinfo32 for all my
servers, which creates an individual text file for each server with
unicode formatting. Since I need it to be ANSI formatting, I need a
command line method to be able to save the file with ANSI formatting.
The concept of redirection isn't that difficult Jim.

Type and more send output to the console but this can easily be
redirected to another file.

More is a filter which allows you to read text pagewise when used inter-
actively but in a batch only transforms to the active codepage.

Something like this should do for you:

msinfo32 /report Yourfile.txt
more Yourfile.txt >converted.txt
Monarch .......

HTH
 
G

Gary Smith

Matthias Tacke said:
:
Hi Torgeir,
that doesn't meet my experience. I saved op's text with textpad as
unicode and see the output:

Perhaps your saved Unicode text was faulty. This could happen if it was
lacking the byte order mark at the beginning of the file. I saved the
output of msinfo32 to a file, verified that the optput was indeed Unicode,
than then used "type msinfo32.txt > ascii_info.txt" to convert it to
ASCII. The result was just as Torgier said.

Notepad can also convert Unicode to ASCII, but it's not nearly so easy to
work into a batch file.
 
M

Matthias Tacke

Gary said:
Perhaps your saved Unicode text was faulty. This could happen if it was
lacking the byte order mark at the beginning of the file. I saved the
output of msinfo32 to a file, verified that the optput was indeed Unicode,
than then used "type msinfo32.txt > ascii_info.txt" to convert it to
ASCII. The result was just as Torgier said.
Hmm, you are right, Textpad allows to save in unicode *and* unicode Big
Endian. I used the first. Nevertheless seems more to be more universal
being able to handle that also.
 
G

gabor salai

Matthias Tacke said:
Hmm, you are right, Textpad allows to save in unicode *and* unicode Big
Endian. I used the first. Nevertheless seems more to be more universal
being able to handle that also.

hmm, it seems that "type" is the converter, not "more"?
but, anyway, isn't it missing in "type command help", because that
conversion capability is not mentioned anyway!
there is only a note about type-ing of "binary" files.

are there maybe some another "implicit" features of "type", not visible at
the first sight?
 
D

David Candy

Windows guesses the format (there's an API call). But as it can't tell content it often guesses wrong. After all it may be an ansi file that just happens to start with a unicode identifier. You can specify all sorts of tests to be made but

Remarks
As noted in the preceding table of flag constants, the IS_TEXT_UNICODE_STATISTICS and IS_TEXT_UNICODE_REVERSE_STATISTICS tests use statistical analysis. These tests are not foolproof. The statistical tests assume certain amounts of variation between low and high bytes in a string, and some ASCII strings can slip through. For example, if lpBuffer points to the ASCII string 0x41, 0x0A, 0x0D, 0x1D (A\n\r^Z), the string passes the IS_TEXT_UNICODE_STATISTICS test, though failure would be preferable.
 
T

Torgeir Bakken \(MVP\)

gabor said:
hmm, it seems that "type" is the converter, not "more"?
Hi

Actually, I think it is the redirection (>) that does the converting,
this works fine as well to convert from unicode to ascii:

more msinfo32.txt > ascii_info.txt
 
G

gabor salai

Torgeir Bakken (MVP) said:
Hi

Actually, I think it is the redirection (>) that does the converting,
this works fine as well to convert from unicode to ascii:

more msinfo32.txt > ascii_info.txt

not to be of great importance, but simple:
"type unicode_text_file" on cmd promt gives correct display of file content
on prompt window
while, on other hand:
"edit unicode_text_file" gives garbaged, doublelettered file [as expected]

so, it seems [form me] that actualy "stdout" and "stderr" subsystems are
doing conversion
[they are part of "type", "more" ...]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top