changes on script edit

- utf8 handling
- native const PHP_EOL
code shorter