      })
      ```
      */
-    public class func updateFile(filename: String, url: String, header: [String: String]? = nil, replacingTexts: [String: String] = [:], didReplaceFile: ((destinationURL: NSURL?, error: NSError?) -> ())? = nil) -> NSURL? {
+    public class func updateFile(filename: String, url: String, header: [String: String]? = nil, encoding: UInt = NSUTF8StringEncoding, replacingTexts: [String: String] = [:], didReplaceFile: ((destinationURL: NSURL?, error: NSError?) -> ())? = nil) -> NSURL? {
         let fileManager = NSFileManager.defaultManager()
         let destinationText: String
         

                    return completion("download for file '\(filepath)' failed with error: \(error)")
            }
            
            let text = String(data: data, encoding: NSUTF8StringEncoding) ?? ""
            let destinationText = try? String(contentsOfFile: filepath) ?? ""
            
            if !text.isEmpty && (text != destinationText) {
                do {
                    try text.writeToFile(filepath, atomically: true, encoding: NSUTF8StringEncoding)
                    completion("successfully updated file '\(filepath)'")
                } catch let error as NSError {
                    completion("writing to file '\(filepath)' failed with error: \(error)")

        return NSURL(string: "file://" + documentsPath)?.URLByAppendingPathComponent(filename)
    }
    
    private class func updateBundleFile(filepath: String, url: String, header: [String: String]? = nil, encoding: UInt = NSUTF8StringEncoding, completion: (String) -> ()) {
        guard let url = NSURL(string: url) else {
            return completion("invalid url for file '\(filepath)'")
        }
