Unicode isn’t friendly to vbscript

I was trying to write a script to read a text file and evaluate the data to do some formatting on it.  This is for a project I am working on and the person that gave me the text file wants some changes made based on the contents of the file.  I have done similar things before, but I kept having trouble with this one.

I started with trying to do a readline and then echo that back.  Every time I tried it, I got  ÿ_[  (y with the umlaut, underscore and the bracket)as the output for the first line and then nothing for everything after that.  I tried it against other text files and got the expected result.  I was investigating, trying to figure out if there was a character in the file that didn’t work well, and finally decided to try and do a writeline to another text file to see if it would at least write the value out that way. 

Imagine my surprise when the results came back with a space between each letter in the source file.  Turns out that it was in UNICODE format.  I saved it as ANSI and then everything was golden.  I also noticed that the file was half the original size…  must have to do with all those extra spaces…

Leave a Reply