// ps1 and ps2 are set by PythonContext and only on the initial load public static void setdefaultencoding(CodeContext context, object name) { if (name == null) { throw PythonOps.TypeError("name cannot be None"); } if (!(name is string strName)) { throw PythonOps.TypeError("name must be a string"); } PythonContext pc = context.LanguageContext; Encoding enc; if (!StringOps.TryGetEncoding(strName, out enc)) { throw PythonOps.LookupError("'{0}' does not match any available encodings", strName); } pc.SetDefaultEncoding(enc); }