[TxMt] Re: Problems handling Windows-encoded files
Trevor Harmon
trevor at vocaro.com
Wed Jan 4 06:42:42 UTC 2012
On Jan 3, 2012, at 7:24 PM, Allan Odgaard wrote:
> On 04/01/2012, at 07.45, Trevor Harmon wrote:
>
>> […] Is there any way to have TextMate autodetect the encoding so that opening and searching files works as expected? Thanks,
>
> The thing is, it’s impossible to do auto-detection with 100% certainty.
>
> UTF-8 though comes very close to being 100% auto-detectable, so TM2 tests for that, and lets user do the hard work when it is not UTF-8 to remind users that they really should be using UTF-8.
I realize encoding detection is a guessing game, but it looks like TM2 doesn't even try to guess. It simply gives up and bugs the user (when opening) or treats the file as an opaque binary (when searching). I work with a project that contains many non-UTF-8 files, so I'm constantly seeing the "Unknown Encoding" dialog, and the Find In Project command is less than useful.
> What you can do is set a file’s encoding via Apple’s encoding attribute or via .tm_properties — but really, use UTF-8!
That was the first thing I tried. I put:
encoding = "Western - Windows"
in the project's .tm_properties file, but it seemed to have no effect.
I also changed the Encoding setting in the Preferences, but that too had no effect. (Does it only pertain to saving?)
> So bottom line: if you want to use cutting-edge alpha builds, don’t use legacy encodings from last century ;)
In this case I am working with a team of Windows developers, so I'm inheriting a lot of Windows code with proprietary encoding.
Is there some way to force an encoding to be used if the UTF-8 detection fails? I think that would be a perfectly fine solution for me, if I could get it to work.
Thanks,
Trevor
More information about the textmate
mailing list