public static void OnBeforeScriptRead(HostedScriptEngine engine) { var cfg = engine.GetWorkingConfig(); string openerEncoding = cfg["encoding.script"]; if (!String.IsNullOrWhiteSpace(openerEncoding)) { if (StringComparer.InvariantCultureIgnoreCase.Compare(openerEncoding, "default") == 0) { engine.Loader.ReaderEncoding = FileOpener.SystemSpecificEncoding(); } else { engine.Loader.ReaderEncoding = Encoding.GetEncoding(openerEncoding); } } var strictWebRequest = ConvertSettingValueToBool(cfg["http.strictWebRequest"]); if (!strictWebRequest) { SetAllowUnsafeHeaderParsing(); } if (CodeStatisticsEnabled) { engine.EnableCodeStatistics(); } }