protocool / AckMate

TextMate plugin (Cocoa) shell for running 'ack'
MIT License
723 stars 34 forks source link

AckMate error in 1.1.2 #12

Open ramonrails opened 14 years ago

ramonrails commented 14 years ago

Please check this error. I was not able to copy the text, so pasted screenshot. http://img63.imageshack.us/img63/2135/ackmate112error.jpg

the same search worked with 1.1.1

protocool commented 14 years ago

what's the file encoding of the file you're searching?

ramonrails commented 14 years ago

Mine is set to UTF8 with LF line endings (also for existing files)

For a faster response or interaction, please find me as ramonrails on any major IM channel. I am online now, if you like to discuss.

protocool commented 14 years ago

Sorry, I have no time to walk through your issue over IM.

All I can say is that perl is complaining that it's encountering files that aren't utf8 encoded.

Version 1.1.2 expects everything to be utf8 so that it can correctly match characters rather than bytes.

I'm sure you're as busy as I am so I won't ask you to try and track down which files in your tree are causing it to choke (the first couple of errors occur at line numbers that indicate one of the offending files is non-binary and has no extension), but if you happen to discover it, having an example would help me to address the issue.

In the mean-time, your best bet is to install 1.1.1 and wait until I add an option to turn of utf8 searching on a per-project basis.

Regards, Trev

ramonrails commented 14 years ago

this project has files from the client checked into git repo. the project is also about 4 years old. I will see if I can find time to track the non-utf8 files and fix them (unless limited by some factor)

One feature request: switching off UTF8 sound good. Can you maybe also display the list of files that are not UTF8? That may help users to track the files easily and see if they can re-encode it to UTF8. Should be simple since you already have the file loaded for searching, collecting its name would be simple, I presume.

I professionally work only with ruby based apps. I would love to submit some patches in Obj-C when I can find some time. Need to learn it first :o)

Thanks for the quick update anyways. Sincerely appreciated.

ramonrails commented 14 years ago

I was in-fact thinking of "helping you walk through the issue to find a solution faster". Not "helping me to walk-through the problem" :o)

I already switched to 1.1.1 immediately after the error. Cannot afford to lose time. But, I can always take some time out to help in any way I can for an awesome piece of work you have done so far. Very fast searches!

Many thanks.

krikis commented 14 years ago

@ ramonrails

I solved this problem as follows. I opened ackmate_ack in mate mate /Users/samuel/Library/Application\ Support/TextMate/PlugIns/AckMate.tmplugin/Contents/Resources/ackmate_ack and added this on line 1560 App::Ack::warn( "$filename" ); Then I did a search. At the end of the search output, all searched files are now listed and the ones followed by the error you mentioned are the ones that are not UTF8 encoded.

In my case it turned out these were .pdf files. By simply adding --type-set=bin=.pdf --nobin to my ~/.ackrc file, the problem was solved.

Hope this works for you (And don't forget to remove the App::Ack::warn( "$filename" ); line when you're done :P)

Cheers,

Samuel

ramonrails commented 14 years ago

That did not work for me. I have a lot of files in the project that I do not wish to touch just for this sake.

spovich commented 14 years ago

+1 for an option to turn-off UTF-8 searching. I have some included libraries that have hundreds of 'problems' with UTF-8 encoding, so using 1.1.1 for now.

Thanks for AckMate! Awesome stuff!

jjb commented 14 years ago

the formatting in krikis's solution above got messed up, it should be:

--type-set=bin=.pdf
--nobin

(and it worked for me)

rvega commented 13 years ago

+1

vosechu commented 13 years ago

@krikis, thanks for your fix. That works for me.

jjb commented 13 years ago

Alright folks, I've put together a solution for reporting offending files. Tell me what you think: https://github.com/protocool/AckMate/wiki/Unicode-UTF-8-error-message

vosechu commented 13 years ago

Thanks jjb. Can you add a comment about what to do with the files in the wiki (adding the nobin option, doing the type-set thing)

vosechu commented 13 years ago

shit. Nm. It's a wiki.

2called-chaos commented 13 years ago
--nobinary
--type-set=bin=.pdf,.csv
--nobin
--ignore-dir=.git

Worked for me but maybe it would work without the git line too. And a nice and awesome snippet to get a list of non utf-8 files:

find . -type f | xargs -I {} bash -c "iconv -f utf-8 -t utf-16 {} &>/dev/null || echo {}"

and I added this directly as an alias:

alias utf8_fail="find . -type f | xargs -I {} bash -c \"iconv -f utf-8 -t utf-16 {} &>/dev/null || echo {}\""