Michel Claveau Posted June 6, 2008 Posted June 6, 2008 (edited) Hi! This windows/console command:CMD /U /C DIR *.jpg > listdir.txt give a file, in UTF-16. But this file has no "Unicode-UTF16 header". FileRead don't open the file with UTF-16 decoding. Any idea, for force FileRead to use UTF-16? Thanks in advance. Edited June 6, 2008 by Michel Claveau
Airwolf Posted June 6, 2008 Posted June 6, 2008 Take a look at the mode parameters for FileOpen() in the help file. You can force the file to open in UTF-16 before you read it. Certifications: A+, Network+, Security+, Linux+, LPIC-1, MCSA | Languages: AutoIt, C, SQL, .NETBooks: AutoIt v3: Your Quick Guide - $7.99 - O'Reilly Media - September 2007-------->[u]AutoIt v3 Development - newbie to g33k[/u] - Coming Soon - Fate Publishing - Spring 2013UDF Libraries: SkypeCOM UDF Library | ADUC Computers OU Cleanup | Find PixelChecksumExamples: Skype COM Examples - Skype4COMLib Examples converted from VBS to AutoIt
Michel Claveau Posted June 6, 2008 Author Posted June 6, 2008 Hi! Airwolf123 said: Take a look at the mode parameters for FileOpen() in the help file. You can force the file to open in UTF-16 before you read it.Thank you, but (Aaaarrrrggghh!!!) this parameter is only for Writing, and don't run for reading.
Airwolf Posted June 6, 2008 Posted June 6, 2008 Michel Claveau said: Hi! Thank you, but (Aaaarrrrggghh!!!) this parameter is only for Writing, and don't run for reading.Sorry, I must've overlooked that. However, from the help file entry for FileRead(): AutoIt Help said: Both ANSI and UTF16/UTF8 text formats can be read - AutoIt will automatically determine the type. Certifications: A+, Network+, Security+, Linux+, LPIC-1, MCSA | Languages: AutoIt, C, SQL, .NETBooks: AutoIt v3: Your Quick Guide - $7.99 - O'Reilly Media - September 2007-------->[u]AutoIt v3 Development - newbie to g33k[/u] - Coming Soon - Fate Publishing - Spring 2013UDF Libraries: SkypeCOM UDF Library | ADUC Computers OU Cleanup | Find PixelChecksumExamples: Skype COM Examples - Skype4COMLib Examples converted from VBS to AutoIt
Michel Claveau Posted June 6, 2008 Author Posted June 6, 2008 re-Hi! Airwolf123 said: AutoIt will automatically determine the type.OK, but for that, AutoIt use the "Unicode-header" (FF-FE or FE-FF, for UTF-16). Unfortunately, sometimes, this information is missing, as in the case that I gave. That is why I try to "force" the mode of reading in Autoit.
Pain Posted June 6, 2008 Posted June 6, 2008 how about FileOpen, view as hex, add the header, save and now open? I know it might sound stupid and I'm not even sure if it will work but that's the only way I could think about.
Michel Claveau Posted June 6, 2008 Author Posted June 6, 2008 Hi! Pain said: how about FileOpen, view as hex, add the header, save and now open?I know it might sound stupid and I'm not even sure if it will work but that's the only way I could think about.I reached the same conclusion. Too bad we can not force the encoding FileRead :-(
Michel Claveau Posted June 6, 2008 Author Posted June 6, 2008 Hi, all! I found! Look this example: $data = BinaryToString(FileRead($myfile),2) @+ -- MCI
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now