On Sep 22, 2007, at 8:48 AM, Křištof Želechovski wrote:

I do not share your reservations. The file contents does not constitute its property and, unlike properties, much work is actually needed to extract it.
Therefore the name chosen seems very appropriate.

How is the character encoding determined when the file is read as text?

Obviously, if the way to get the contents as text requires providing the encoding, then it has to be a method. My comment was about the no- argument methods. But you have a point that reading from disk is not a simple get operation. Probably the methods should have names based on read or the like (read(), readAsText(), etc) to indicate this. Also, they should arguably be asynchronous since reading from the disk can be slow, especially for large files, and it is undesirable to block the main thread.

Also, I'm not sure how a web app can be expected to know the encoding of a text file on disk.

An arbitrary file is a sequence of bytes and it is up to the application how
these bytes are interpreted as characters.
Moreover, a text file conceptually does not contain a string; it contains, by convention, lines of text. The result of reading a file as text should be a sequence of lines, not a string, with the line breaking characters
removed.

Disagree. If the goal is to later upload the text file, then you want to preserve line endings and other special characters as-is.

Regards,
Maciej

Reply via email to