Support sqlScriptEncoding in schema.sql

Fixes gh-1165, fixes gh-1164