 	/** A textual representation of this instance, suitable for debugging. */
 	public var debugDescription: String {
 		var result = ""
-		debugPrint("encoding:", encoding, "stdin:", stdin, "stdout:", stdout, "stderror:", stderror, "currentdirectory:", currentdirectory, to: &result)
+		debugPrint("stdin:", stdin, "stdout:", stdout, "stderror:", stderror, "currentdirectory:", currentdirectory, to: &result)
 		debugPrint("env:", env, to: &result)
 		return result
 	}
 }
 
 public struct ShellContext: ShellContextType {
-	public var encoding: String.Encoding
 	public var env: [String: String]
 
 	public var stdin: ReadableStream

public final class MainShellContext: ShellContextType {

	/** 
	The default character encoding for SwiftShell.

	TODO: get encoding from environmental variable LC_CTYPE.
	*/
	public var encoding = String.Encoding.utf8
	public lazy var env = ProcessInfo.processInfo.environment as [String: String]

	public lazy var stdin: ReadableStream = { FileHandleStream(FileHandle.standardInput, encoding: self.encoding) }()
	public lazy var stdout: WritableStream = { StdoutStream.default }()
	public lazy var stderror: WritableStream = { FileHandleStream(FileHandle.standardError, encoding: self.encoding) }()


	/** Creates a blank ShellContext. */
	public init () {
		let encoding = String.Encoding.utf8
		env = [String:String]()
		stdin =    FileHandleStream(FileHandle.nullDev, encoding: encoding)
		stdout =   FileHandleStream(FileHandle.nullDev, encoding: encoding)
		stderror = FileHandleStream(FileHandle.nullDev, encoding: encoding)
		currentdirectory = main.currentdirectory
	}

	/** Creates a new ShellContext from another ShellContextType. */
	public init (_ context: ShellContextType) {
		env = context.env
		stdin =    context.stdin
		stdout =   context.stdout
		stderror = context.stderror
		currentdirectory = context.currentdirectory
	}
}
