[TxMt] Tidy and XML

Nicholas Orr nick at goya.com.au
Wed Nov 30 02:05:02 UTC 2005


On 30/11/2005, at 8:19 AM, Allan Odgaard wrote:

> 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)).

Ok, you go along running a computer business, thinking you know a   
fair bit, and then something just goes straight over your head.   
Thanks for taking the time to reply, but you've lost me.  Unicode is  
one thing I haven't kept track of at all.

In the end I did #3, and it worked fine.  It worked so well I went  
and bought a copy.

Thanks for your help.

Nick


More information about the textmate mailing list