[OS X TeX] Spotlight

Richard Koch koch at math.uoregon.edu
Tue May 21 15:51:54 CEST 2013


On May 21, 2013, at 3:30 AM, Eric van der Oord <eric.vanderoord at gmail.com> wrote:

> Hi all,
> 
> To return to the original problem, can we ask Spotlight to index a .tex file encoded in Mac Roman?
> 

I looked (briefly) at the code for the mdimporter inside TeXShop, which was
written by Norm Gail with minor modifications by Max Horn. I won't have time
to look more until at least next week.

The code tries to read the text to be indexed in UTF-8. If the returned string
is empty (which means the text isn't in UTF-8), it opens it in ISO-Latin1.
And if this string is empty, then it opens it in Mac OS Roman. And if that
string is empty, then the code gives up.

Maybe I'm wrong, but I think that any file will open in ISO-Latin1, even if
it was written in a different encoding. So I suspect that the Mac OS Roman
step won't be reached. However, ISO-Latin1 is ASCII  + extra stuff
so most Mac OS Roman files will index fine.

There is a routine in the NSString class which tries to guess the encoding
of a file, so perhaps it would be best to try UTF-8 and upon failure use that
routine to guess the encoding.

Dick




More information about the macostex-archives mailing list