         waitForExpectations(timeout: 30, handler: { err in })
 
         let swstr = String(view)
-        let nsstr = (try? NSString(contentsOfFile: file, encoding: String.Encoding.utf8.rawValue)) ?? "XXX"
-
-        XCTAssertTrue(String(describing: nsstr) == swstr, "file contents did not match: \(swstr.utf16.count) vs. \(nsstr.length)")
+        let filestr = try String(contentsOfFile: file, encoding: String.Encoding.utf8)
+
+        XCTAssertTrue(filestr == swstr, "file contents (high=\(high)) did not match: \(swstr.count) vs. \(filestr.count)")
     }
 }
 

        return rnd
    }

    func testDispatchFile() {
        
        weak var xpc = expectation(description: #function)

        let file = #file
        var view = String.UnicodeScalarView()
            var encoding = UTF8()

        let high = Int(rnd(1024)) + 10
            // high=2 => decoding error

    case openError(Int32, String)
}

/// Creates a stream channel to the given file path
func channelZFile(_ path: String, queue: DispatchQueue = DispatchQueue.global(qos: .default), low: Int? = nil, high: Int? = nil, interval: DispatchTimeInterval? = nil, strict: Bool = false) -> Channel<DispatchIO, InputStreamEvent> {
    let receivers = ReceiverQueue<InputStreamEvent>()

