Michel Claveau Posted June 6, 2008 Share 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 Link to comment Share on other sites More sharing options...
Airwolf Posted June 6, 2008 Share 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 Link to comment Share on other sites More sharing options...
Michel Claveau Posted June 6, 2008 Author Share Posted June 6, 2008 Hi! 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. Link to comment Share on other sites More sharing options...
Airwolf Posted June 6, 2008 Share Posted June 6, 2008 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():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 Link to comment Share on other sites More sharing options...
Michel Claveau Posted June 6, 2008 Author Share Posted June 6, 2008 re-Hi! 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. Link to comment Share on other sites More sharing options...
Pain Posted June 6, 2008 Share 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. Link to comment Share on other sites More sharing options...
Michel Claveau Posted June 6, 2008 Author Share Posted June 6, 2008 Hi!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 :-( Link to comment Share on other sites More sharing options...
Michel Claveau Posted June 6, 2008 Author Share Posted June 6, 2008 Hi, all! I found! Look this example: $data = BinaryToString(FileRead($myfile),2) @+ -- MCI Link to comment Share on other sites More sharing options...
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