FINDSTR and Unicode strings

0.00 avg. rating (0% score) - 0 votes

Recently I had another look at my old post on finding unused resources in a .NET project, and realized that it would not work if any of the resource strings contain Unicode characters. The culprit turns out to be the FINDSTR command, which doesn’t support Unicode text files. To solve the problem, I replace FINDSTR with FIND.EXE (which supports Unicode). However, all is lost when my usage of FOR to tokenize the input files stops working with Unicode input. I also tried a few suggestions here and here to no avail.

My simple conclusion is that, batch script was not designed with Unicode in mind. Perhaps Windows Powershell can probably do a better job…

0.00 avg. rating (0% score) - 0 votes
ToughDev

ToughDev

A tough developer who likes to work on just about anything, from software development to electronics, and share his knowledge with the rest of the world.

3 thoughts on “FINDSTR and Unicode strings

  • November 9, 2013 at 5:37 pm
    Permalink

    Excellent tip!

  • February 25, 2015 at 9:37 am
    Permalink

    Or just "type unicode.txt | findstr /i stringtobesearched"

  • February 18, 2022 at 1:51 am
    Permalink

    I’m not a big fan of powershell … but it does do this well, especially for scanning the files in a directory tree…

    powershell -Command “Get-ChildItem c:\ -Exclude *.exe,*.dll,*.cab,*.msi,*.zip -File -Recurse -EA SilentlyContinue | Select-String -Pattern ‘findable text'”

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>