Jump to content

Recommended Posts

Posted (edited)

the help file states: "... functions such as FileReadLine..." regarding functions that automatically detect the file encoding. which are the other "such" functions? is FileReadToArray() one of them?

i'm also unsure on how to test this. i used a simple script to FileOpen() a new text file with all encoding formats mentioned in the FileOpen() help. then i used FileReadToArray() to read it - i get back a good result for all encoding formats. so either FileReadToArray() is detecting the encoding properly, or i'm testing it wrong. how can i be sure?

EDIT: that's my test script. using 128,64,32,16 instead of 256 for encoding formats.

#include <Array.au3>

$sFile=@ScriptDir&'\FileReadToArray-test.txt'

$hFile=FileOpen($sFile,2+256)
FileWriteLine($hfile,'Line1')
FileWriteLine($hfile,'Line2')
FileClose($hFile)

$a=FileReadToArray($sFile)
_ArrayDisplay($a)
Edited by orbs

Signature - my forum contributions:

Spoiler

UDF:

LFN - support for long file names (over 260 characters)

InputImpose - impose valid characters in an input control

TimeConvert - convert UTC to/from local time and/or reformat the string representation

AMF - accept multiple files from Windows Explorer context menu

DateDuration -  literal description of the difference between given dates

Apps:

Touch - set the "modified" timestamp of a file to current time

Show For Files - tray menu to show/hide files extensions, hidden & system files, and selection checkboxes

SPDiff - Single-Pane Text Diff

 

Posted

I would say your testing method is sound. Rather than just opening the files, I assume you also wrote to each file with different encoding options. I can't imagine how FileReadToArray could work at all if it didn't automatically detect the encoding.

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...