[TxMt] Tidy and XML

Allan Odgaard throw-away-1 at macromates.com
Tue Nov 29 21:19:58 UTC 2005


On 29/11/2005, at 21:45, Nicholas Orr wrote:

> <?xml version="1.0" encoding="UTF-16"?>

That's the problem. This will make xmllint (used by the Tidy command)  
return the result as utf-16, but TextMate expects it to be utf-8, and  
so it'll show up wrong.

There's a few options:
  1) convert the files from a script instead
  2) change to "UTF-8" (remember to convert the files to utf-8 as  
well, if they're currently in utf-16 format)
  3) change the “xmllint --format -” line to “xmllint --format -| 
iconv -f ucs-2 -t utf-8” in the Tidy command (Bundle Editor -> Show  
Bundle Editor -> XML -> Tidy).

Since it sounds like you have a lot of files to convert, option 1 has  
advantages in itself over manually selecting Tidy from TM.

Personally I'd use a script, but also let the script convert the  
files to utf-8 (utf-8 is generally a better encoding than utf-16, and  
while my reference to this is vague, I think part of the Unicode  
consortium do see utf-16 as legacy, especially now that it no longer  
has a 1:1 mapping to unicode code points (because of ucs-4)).





More information about the textmate mailing list