Created
May 24, 2022 12:23
-
-
Save lgolubyev/07595ab82f4fe16422b60ba16432db28 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var nonRenderingCategories = new UnicodeCategory[] { | |
UnicodeCategory.Control, | |
UnicodeCategory.OtherNotAssigned, | |
UnicodeCategory.Format, | |
UnicodeCategory.Surrogate }; | |
using StreamReader sr = new StreamReader(dotnetFile); | |
while (sr.Peek() >= 0) | |
{ | |
var c = (char)sr.Read(); | |
var category = Char.GetUnicodeCategory(c); | |
var isPrintable = Char.IsWhiteSpace(c) || | |
!nonRenderingCategories.Contains(category); | |
if (!isPrintable | |
{ | |
alert(dotnetFile); | |
issuesCount++; | |
break; | |
} | |
} | |
sr.Close(); | |
sr.Dispose(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment