[TxMt] Re: unicode issue with QuickLook on Leopard

Adam R. Maxwell amaxwell at mac.com
Sun Jun 29 22:57:39 UTC 2008

On Jun 29, 2008, at 3:07 PM, Allan Odgaard wrote:

> Explictly tagging text files with
> extended attributes to tell the systme that they are UTF-8 is IMO very
> wrong, especially given that UTF-8 can be recognized with 99.999999%
> certainty (so even if one disagrees about making it the standard
> encoding, it can still be at least detected safely without mistakenly
> treating e.g. a MacRoman file as UTF-8).

According to the Foundation release notes, 10.5 now tries UTF-8 as a  
fallback if -[NSString initWithContentsOfURL:usedEncoding:error] is  
used (presumably if xattrs and BOM are absent).  Does that answer your  
suggestion?  Personally, I like the idea of using xattrs for this, but  
we were using them for that purpose before Leopard.

MacRoman is a good fallback encoding if UTF-8 fails, but QL is  
evidently using it too early.  In fact, it looks like  
NSAttributedString doesn't try UTF-8 and goes right to MacRoman, which  
probably explains the OP's problem with TextEdit.  Very unfortunate.


More information about the textmate mailing list