Refactor css charset scanner