Skip to content

Instantly share code, notes, and snippets.

@lgolubyev
Created May 24, 2022 12:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lgolubyev/07595ab82f4fe16422b60ba16432db28 to your computer and use it in GitHub Desktop.
Save lgolubyev/07595ab82f4fe16422b60ba16432db28 to your computer and use it in GitHub Desktop.
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