[TxMt] Re: Problems handling Windows-encoded files

Allan Odgaard mailinglist at textmate.org
Wed Jan 4 19:16:58 UTC 2012

On 04/01/2012, at 13.42, Trevor Harmon wrote:

> […] it looks like TM2 doesn't even try to guess

Correct — a bad guess can do more harm than good, and trust me, I have talked with plenty of users who managed to mess up their files by not knowing the importance of correcting a bad guess, so the current solution, while definitely provisional, I consider “the right direction” — i.e. make the user aware that he is walking on thin ice — but ideally the modal dialog sheet should just a top-bar a la Chrome’s “This page appears to be in Thai, do you want to translate it?”, and some heuristics to make a better default choice and possibly some options to make choices sticky.

All but UTF-8 being legacy though, this is polish that comes after more pressing matters ;)

> […] I put:
> encoding = "Western - Windows"
> in the project's .tm_properties file, but it seemed to have no effect.

See <x-man-page://iconv_open/3> for possible encodings. For “Western — Windows” you need to use CP1252.

> I also changed the Encoding setting in the Preferences, but that too had no effect. (Does it only pertain to saving?)

This is one of the settings that just has no effect, period.

> […] 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.

Setting encoding in the .tm_properties file will fix it for regular file opens but the folder search code presently skip all this, so afraid here you will still see “binary file” and for now I advice strongly against using the folder search with anything but UTF-8 + LF.

More information about the textmate mailing list