[TxMt] Insert encoded txt, htm, html files; Insert doc, rtf, webarchive files

Hans-Joerg Bibiko bibiko at eva.mpg.de
Mon Nov 13 13:57:17 UTC 2006


Dear all,

I just wrote a small Drag&Drop command for inserting encoded txt,  
htm, html files and doc and rtf files.

The background:
I get a lot of data written as doc, rtf, html, and txt files which  
are encoded in different encodings like Shift_JIS, EUC-JP, Big5, etc.

In order to insert these data in my document I wrote a tiny drag&drop  
command which makes usage of the tm_dialog and the UNIX command  
'textutil'.


The usage is very simple. Just drag one or more selected files to an  
open TM document. The dialog will ask you for the source encoding and  
the output format. Press 'Insert' and the tool will convert  
everything to utf-8 text/html/rtf/rtfd/wordml format. See more detail  
with 'man textutil'

The encoding 'no conversion' will avoid a conversion. To change the  
available encodings just open the 'icf.plist' within the bundle with  
TM or the plist editor. Only IANA names for encodings are allowed.

I leave the scope empty. File Types I set to 'doc, rtf, htm, html,  
txt, webarchive'. But, it is easy to customize it.

Now you can drag e.g. a WORD document and insert it as uft-8 (cleaned  
up) html in your current document.

For me it works perfectly. Of course, 'textutil' cannot do magic  
things but for 95% of all cases it works pretty good.

Maybe some of you find it also quite useful  ;)

Comments are welcomed, as always.

Have a nice day,

Hans

-------------- next part --------------
A non-text attachment was scrubbed...
Name: InsertCodedFile.tmbundle.zip
Type: application/zip
Size: 13952 bytes
Desc: not available
URL: <http://lists.macromates.com/textmate/attachments/20061113/603f1481/attachment.zip>


More information about the textmate mailing list