the_silver_searcher icon indicating copy to clipboard operation
the_silver_searcher copied to clipboard

Add --as-text option

Open murmour opened this issue 7 years ago • 5 comments

This PR adds a new --as-text option, which is equivalent to the --text option in GNU Grep.

Without this option, ag sometimes interprets cp1251-encoded sources as binaries. Effectively, the new option disables the binary detection heuristic, which makes perfect sense for situations where ag is asked to perform search only in files with a specific extension (corresponding to a particular language).

murmour avatar Dec 01 '17 21:12 murmour

Ping. I use this feature all the time to reliably grep through sources that contain non-ASCII characters.

murmour avatar May 05 '18 03:05 murmour

Hi, really required this param, to proper search

proggga avatar Mar 23 '19 19:03 proggga

Any follow up on this?

ethanabrooks avatar Jan 25 '21 00:01 ethanabrooks

Seconding this. I was surprised to find I couldn't just rename my binary file to .txt and ag through it :)

adamtaylor13 avatar Feb 15 '21 18:02 adamtaylor13

@murmour Thank you for MR, you saved me.

Also voting for inclusion this patch into main source tree. For some reason it treats regular text files in single byte encoding as binary ones.

vandrlexay avatar Mar 05 '24 15:03 vandrlexay