Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add --as-text option #1184

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Add --as-text option #1184

wants to merge 1 commit into from

Conversation

murmour
Copy link
Contributor

@murmour murmour commented Dec 1, 2017

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

This is equivalent to the --text option in GNU Grep.
@murmour
Copy link
Contributor Author

murmour commented May 5, 2018

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

aswild pushed a commit to aswild/the_silver_searcher that referenced this pull request Jul 23, 2018
This is equivalent to the --text option in GNU Grep.

Cherry-pick: ggreer#1184
@proggga
Copy link

proggga commented Mar 23, 2019

Hi, really required this param, to proper search

@ethanabrooks
Copy link

Any follow up on this?

@adamtaylor13
Copy link

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

@proggga proggga mentioned this pull request Feb 15, 2021
@vandrlexay
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants