I'm trying to convey to you that, despite being coded as either UTF-8 or
Windows-1252 in the program, the binary image of the file might be
identical, and therefore there's no way for Notepad to tell which one it
is -- thus producing the symptom that Jeff described, where he creates
the file as UTF-8, and Notepad detects it to be Windows-1252.
According to his post, the first file generated is reliably considered
UTF-8 by Notepad, while the rest are reliably considered ANSI. If
there is no detectable difference, then why wouldn't it always be one
or the other, or at least random?
This is why it seemed to me (perhaps mistakenly so) that you were not
reading carefully enough.
A more helpful diagnosis of the symptoms described might be: Assuming
Notepad chooses the "simpler" encoding where possible (a guess on my
part; I have not confirmed this), and assuming that all the characters
show up *as intended* in Notepad, then check the data to see if the
first file always has characters specific to UTF-8, whereas the
remaining files only have characters that are common to ANSI and
UTF-8, thus allowing Notepad to treat those files as ANSI.
If all the files generated are, say, 7-bit clean ASCII; or if some of
the 2nd through nth files have extended characters, then it is
certainly a mystery why Notepad would pick the first one to treat as
UTF-8 while the rest are treated as ANSI. To me, this would suggest
there is something about the files themselves which is prompting
Notepad to behave in the described way, which in turn would suggest
something about the program(s) generating the files.
John