move non-ascii filtering to a dedicated function