forgive my naivety here but ive never had to use Unicode before.

 

I learned many years ago how to open a simple ascii file using perls open.

 

open (IN, 'infile.txt');

 

then read records out of the ascii file.

 

while ($rec = <IN>) {

                        print $rec;

}

 

but today I wanted to write a perl script to evaluate the data from a text
file that gets created when one runs the Microsoft 'msinfo32.exe' program.

 

msinfo32.exe /report msinfo.txt (this will dump vital system info to a text
file)

 

the problem here is that the 'msinfo.txt' file is not written in (single
byte per character, ascii) format.  instead the first two bytes of the file
happen to be (hexFF)(hexFE).  Beyond the first two bytes, each human
readable ascii character is represented with TWO BYTES, (hex-ascii character
value)(hex00)

 

I assume this is some form of Unicode encoding.  though I do not know the
type.  

 

if anyone out there knows what kind of encoding this is, it would be
wonderful to know the encoding type Microsoft has used here.

 

in addition, if anyone knows how to modify the following block so that I can
effectively, read the records of this file, and convert the read record into
'plain old ascii' encoding - I would be most appreciative.

 

essentially, this is what I am aiming to do;

 

open (IN, 'infile.txt');

while ($rec = <IN>) {

 
convert_$rec_from_its_current_encoding?_to_simple_ascii_encoding; <<<<<<<<<<
the magic code would go here

                        print $rec;

}

 

 

_______________________________________________
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to