Skip paths that are not utf-16 when scanning directories.

Fixes #15279
Based on #13338