F
Ferrous Cranus
Τη ΔευτÎÏα, 2 ΣεπτεμβÏίου 2013 9:28:36 μ.μ. UTC+3, ο χÏήστης Dave Angel ÎγÏαψε:
That is one Clever Idea Dave.
I take it that the charset of the file 'junk.txt' gets identified by the characters encoding that read form within the file?
But wait a minute: What editor do you uses to write these 3 lines?
I mean am a bit confused.
i for example i 'nano tets.py' which has within:
f = open("junk.txt", "w")
f.write(b'\xb6\xe3\xed\xf9\xf3\xf4\xef\xfc\xed\xef\xec\xe1 \xf3\xf5\xf3\xf4\xde\xec\xe1\xf4\xef\xf2\n')
f.close()
then when i save the file within nano for example by default in utf-8 charset
how would it be able to detect the bytestring within that is supposed to beof greek-iso's
'file' does nothing interesting with the filename, it just opens it and
examines the contents. For example,
file www/cgi-bin/files.py
will examine the Python source file, not run it.
So first in the interpreter, I ran
then at the bash prompt, I ran:
davea@think2:~$ file junk.txt
junk.txt: ISO-8859 text
That is one Clever Idea Dave.
I take it that the charset of the file 'junk.txt' gets identified by the characters encoding that read form within the file?
But wait a minute: What editor do you uses to write these 3 lines?
I mean am a bit confused.
i for example i 'nano tets.py' which has within:
f = open("junk.txt", "w")
f.write(b'\xb6\xe3\xed\xf9\xf3\xf4\xef\xfc\xed\xef\xec\xe1 \xf3\xf5\xf3\xf4\xde\xec\xe1\xf4\xef\xf2\n')
f.close()
then when i save the file within nano for example by default in utf-8 charset
how would it be able to detect the bytestring within that is supposed to beof greek-iso's