Sublime Forum

Find in files which contain control characters

#1

I’ve discovered that Sublime text fails to find anything in files which contain control characters, but only when using “Find in Files”. Using regular find in an open file works fine.

I see this happening with files which are predominantly text but also contain ESC, NAK, DLE, DC2 etc. characters. Just the presence of any one of these characters causes the search to return nothing for that file. Sublime Text always reports that it has searched the correct number of files (e.g. when searching a folder or project), but never finds a match in any of the files which have the control characters.

I can replicate this with OS X and Windows 64-bit versions.

Example of file with control characters - find in files won’t find anything in this file: https://www.dropbox.com/s/whkbmju0kza3l6l/Ctrl%20chars.txt

Example of same file without control characters - find in files works perfectly: https://www.dropbox.com/s/dhn6fdzzoklzjo8/No%20ctrl%20chars.txt

0 Likes

[Bug] in "Find in Files"
#2

Can anyone confirm this issue?

0 Likes

#3

Not sure if you are on ST2 or ST3. But on ST3, it found control characters just fine. Searching for the control characters caused sublime to search in I assume a binary mode because below is what it showed or maybe the content of the file caused it. Either way it found it and showed this:

~/Desktop/untitled folder 2/test.txt: <binary>

0 Likes

#4

I’m running ST2. I’ve just tried ST3 and I see the same thing as you - text is found, but displayed as “”. It’s a step in the right direction I guess!

0 Likes

#5

Unfortunately, it’s a big problem for me, as I often need to look at files that have control codes in them…

0 Likes

#6

@Andrio Celos

You can. “Find in files” won’t show the matching strings in binary files, but if you open the file, then “File…Reopen with encoding->UTF-8” You can see the text file with literal chars for the various 8-bit ASCII control codes.

I’m not sure if there’s a way to get this behaviour automatically.

0 Likes