Adapt script to R17
Add R17 UTF-8 encoding header