MattHiggs

(solved) Issue with file encoding?

5 posts in this topic

#1 ·  Posted (edited)

Hello autoit community.  So this is an issue that I have run into before and never really cared enough until now to figure out what is going on.  I wrote an autoit script which would create a txt file and write 253 lines in the txt file and then close it (I have attached the txt file).  The only flag I used when calling "Fileopen" was 2 (overwrite flag).  I then went and wrote a powershell script which would create files in a particular directory and use the content imported from the txt file created by the Autoit script when naming these files.  However, in doing this, there are many files which has very strange characters that obviously should not be there:

RURmy5t.png

I believe that this is a file encoding issue, so my question is as follows: If I want powershell, vbscript engine, etc. to correctly read the characters contained within an autoit generated text file, what flag(s) should I call "Fileopen" with in order ensure that the created file has the right encoding?

newbooks.txt

Edited by MattHiggs

Share this post


Link to post
Share on other sites



Hello. By default AutoIt write using UTF-8 if you want that AutoIt write in the textfile the characters exactly as you show in the picture use the $FO_ANSI+$FO_OVERWRITE in the flag of FileOpen.

 

Saludos

 

 

Share this post


Link to post
Share on other sites
15 minutes ago, Danyfirex said:

Hello. By default AutoIt write using UTF-8 if you want that AutoIt write in the textfile the characters exactly as you show in the picture use the $FO_ANSI+$FO_OVERWRITE in the flag of FileOpen.

 

Saludos

 

 

Ok.  So, I would like to clarify something on that note....  Does the "$FO_ANSI" flag set the file encoding to ASCII?  I was under the impression ASCII was the encoding the file needed to be in, and initial research seemed to suggest the ANSI and ASCII were different things.  Am I wrong?

 

Share this post


Link to post
Share on other sites

Share this post


Link to post
Share on other sites
2 minutes ago, Danyfirex said:

Ahh.  Very interesting.  Easy to understand and answers my question.  I wish that documentation [that I initially read] would just state it simply like that post did, rather than confuse the hell out of people by over complicating the subject.  

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now