 
     
     /// scan encoding declaration in string
-    func scanEncodingDeclaration(forTags tags: [String], upTo maxLength: Int, suggestedCFEncodings: [UInt32]) -> String.Encoding? {
+    func scanEncodingDeclaration(forTags tags: [String], upTo maxLength: Int, suggestedCFEncodings: [CFStringEncoding]) -> String.Encoding? {
         
         guard !self.isEmpty else { return nil }
         

                }
            }
            
            // text ISO-2022-JP
            if data.prefix(maxDetectionLength).contains(0x1B) {
                // check existance of typical escape sequences
                // -> It's not perfect yet works in most cases. (2016-01 by 1024p)
                for escapeSequence in ISO2022JPEscapeSequences {
                    let escapeSequenceData = Data(bytes: escapeSequence)
                    if data.range(of: escapeSequenceData) != nil {
                        if let string = String(data: data, encoding: .iso2022JP) {
                            usedEncoding = .iso2022JP
                            self = string
                            return
                        }
                    }
                }
            }
        }
        
        // try encodings in order from the top of the encoding list
        for cfEncoding: CFStringEncoding in suggestedCFEncodings {
            guard cfEncoding != kCFStringEncodingInvalidId else { continue }
            
            let encoding = String.Encoding(cfEncoding: cfEncoding)
            
            if let string = String(data: data, encoding: encoding) {

}


private let ISO2022JPEscapeSequences: [Data] = [
    [0x1B, 0x28, 0x42],  // ASCII
    [0x1B, 0x28, 0x49],  // kana
    [0x1B, 0x24, 0x40],  // 1978
    [0x1B, 0x24, 0x42],  // 1983
    [0x1B, 0x24, 0x28, 0x44],  // JISX0212
    ].map { Data(bytes: $0) }


private let maxDetectionLength = 1024 * 8
