In this case I have a folder of .txt files I created using drag and copy and paste from Adobe Acrobat PDFs and Text Editor in OSX. I've been editing these files in vim. Now I'm using grep to find notes in these files. For example,
grep -c "\[t\]" Herbert*
[t] is the note and the directory has 22 files with the name-prefix
Herbert* (as in
Herbert-14-Classification.txt). The trouble is
grep only finds the search string in one file (
Herbert-03-Square.txt), but each file has the same note many times.
The trouble files display
converted in the status bar when I open them,
"Herbert-02-Transformation.txt" [converted] 276L, 57171C
A post at unix.stack suggests special characters from the original have survived the trip from PDF to vim to cause this trouble with
grep. I've been deleting the borked characters and manually inserting the proper
:digraphs. Some of the edited files are searchable by grep and other edited files are not. I attempted to use,
:e Herbert-02-Transformation.txt :set encoding=utf-8` :w
but the file still opens as shown above. Now I'm thinking I need to figure out how to compare the encodings of those files where
grep is working and those where it is not. There are enough help pages detailing how to set up file detection in .vimrc to avoid this problem that I've spent over 1.5 hours researching this, and I now think its a good question...