[TxMt] How to add encodings to "Re-open with encoding" menu

Allan Odgaard throw-away-1 at macromates.com
Fri Apr 14 15:57:06 UTC 2006


On 14/4/2006, at 12:24, Boris Bliznioukov wrote:

> The problem is that I not only want to open files with different
> encoding but also to save them back in the same encoding [...]

I hope this is only for existing files, because for new stuff you  
should use UTF-8.

If you accept text from a web page, if you keep text in a data base,  
or similar, UTF-8 is the only encoding [1] which allow storing of all  
type-able characters -- so use anything else, and you will likely see  
problems (such as truncated/mangled characters) -- even when you  
restrict content to English (or similar) you may still see names,  
quotes, references, and similar use “funny” characters.

Furthermore, UTF-8 is the only encoding where the text editor can  
guess the encoding, meaning you will never have to do “Re-open With”  
which is simply impossible with any other encoding. And having to  
manually do “Re-open With” each time you open a file (or at least  
ensure the editor guessed correctly) sounds like quite a pain.

And, TextMate 2.0 will start to see commands run directly on the  
files on disk for various actions. There is no way these commands  
will be able to incorporate fancy encoding guessing heuristics, UI  
for letting the user choose encoding, or similar.

There are already commands in the current version of TextMate which  
present a subset of a file, or part of the file retrieved from  
elsewhere, e.g. the Subversion actions such as Blame, Diff With XXX,  
etc. Again, there is no way these commands can get the encoding right  
-- so they will assume UTF-8.

I have said it before, but I will say it again: Use UTF-8! It’s not a  
matter of personal preference, UTF-8 is the far superior encoding,  
and all other encodings have serious problems which do come up in  
real life!



[1] “ASCII compatible” is implied in this and other claims.





More information about the textmate mailing list