Replace loop with direct "utf-16be" encoding; fix whitespace