I create a new file with ISO-8859-1 (Latin 1 or Windows) encoding selected, either by doing a Save As.. with ISO-8859-1 selected or setting the File Encoding to ISO-8859-1 in Preferences.
I close the file and reopen it. It's not opening in ISO-8859-1. Does Text Mate reopen all files in UTF-8 event though ISO-8859-1 is specified in Preferences or the file was save as ISO-8859-1?
Thanks, Ed
On 14/10/2005, at 21.50, Ed Wong wrote:
I close the file and reopen it. It's not opening in ISO-8859-1. Does Text Mate reopen all files in UTF-8 event though ISO-8859-1 is specified in Preferences or the file was save as ISO-8859-1?
If you save a file w/o 8 bit characters it is saved as ASCII, no matter what encoding you specify.
TextMate will then open it as ASCII, and if you enter non-ASCII characters and save it again, it will “upgrade” it to utf-8, unless you've set the preferences to something else AND checked that this should apply to existing files as well AND the encoding you've specified can actually represent the characters in the buffer -- otherwise this choice is only honered when the file is encoding less, so to speak (i.e. for new buffers).
That said, you really really should be using utf-8. utf-8 is also the only encoding that TM can safely recognize, since text files do not specify encodings, but utf-8 is made in such a way that statistically you just don't get a false positive for that encoding -- not to mention that all the other 8 bit encodings are lossy and can't represent all the characters you can type.
On 14-10-05 4:07 pm, "Allan Odgaard" throw-away-1@macromates.com wrote:
If you save a file w/o 8 bit characters it is saved as ASCII, no matter what encoding you specify.
TextMate will then open it as ASCII, and if you enter non-ASCII characters and save it again, it will ³upgrade² it to utf-8, unless you've set the preferences to something else AND checked that this should apply to existing files as well AND the encoding you've specified can actually represent the characters in the buffer -- otherwise this choice is only honered when the file is encoding less, so to speak (i.e. for new buffers).
In my case I do have all 3 conditions you specified above and when reopened it doesn't show the accented characters properly. Unless I'm misunderstanding what you're saying. So even if I save a file using an encoding like Latin1 and specify that files will use Latin1 in Preferences and should apply to existing file, it will open the file as ASCII?
That said, you really really should be using utf-8. utf-8 is also the only encoding that TM can safely recognize, since text files do not specify encodings, but utf-8 is made in such a way that statistically you just don't get a false positive for that encoding -- not to mention that all the other 8 bit encodings are lossy and can't represent all the characters you can type.
This is fine but I something need to edit other people's files and they may be saved using a different encoding. I know, use iconv... ;-)
Thanks, Ed
On 14/10/2005, at 22.58, Ed Wong wrote:
In my case I do have all 3 conditions you specified above and when reopened it doesn't show the accented characters properly. [...]
Okay -- then it's just not guessing the correct encoding.
[...] So even if I save a file using an encoding like Latin1 and specify that files will use Latin1 in Preferences and should apply to existing file, it will open the file as ASCII?
It doesn't use the preference setting for opening files, only when saving.
So if the file is ASCII, it's opened as such, if it's UTF-8, then that's what it gets opened as. If it's neither, it uses a heuristic to try and figure out the proper encoding.