[TxMt] Encoding output window to ISO-8859-1?

jdmuys at free.fr jdmuys at free.fr
Fri Feb 13 14:21:02 UTC 2009


Hi,

I unsuccessfully searched the web site and the list archive, but I may have missed something.

I need to work for a client with humongous text files encoded in ISO-8859-1, with diacritical characters.

This is mostly OK, but I could not find a way to set the output window that TextMate opens to ISO-8859-1 encoding. This is a PITA.

I tried both Perl and Ruby and the issue is the same. For the sake of an example, save the following 6 lines (French composers) to a text file encoded in ISO-8859-1, named "test.txt":

Léo Delibes
César Franck
Gabriel Fauré
Edgard Varèse
Jean Françaix
Henri Büsser

Now run the following Ruby program from TextMate:

file = File.open("test.txt", "r")
file.each { |line| print line }
file.close

In the output window, all diacritical chars are replaced by the dummy "white question mark within a black diamond".

This is despite having set the preferences to Latin 1.

Note that the same small Ruby program displays diacritical chars correctly when run from a terminal window (provided the said terminal window is set to ISO Latin 1 of course).

So my question is: is there a way to set the TextMate output window to ISO-8859-1?
A workaround might be to redirect standard err and standard out to another window, already open, with ISO-8859-1 encoding. Is that possible?

I hope my request makes sense.

(Unfortunately, switching to UTF8 is not an option: input is almost 100GB ISO-8859-1, and so output needs be. A roundtrip to UTF8 would triple execution time, which is already too long as it is).


Many thanks,

Jean-Denis





More information about the textmate mailing list