     ///
     /// - SeeAlso: `func urlQueryEncode() -> String`
     /// - Returns: Encoded string
-    func formUrlencode() -> String {
-        return addingPercentEncoding(withAllowedCharacters: HTTPData.formUrlencodedAllowedCharacters)?.replacingOccurrences(of: " ", with: "+") ?? ""
+    public func formUrlencode() -> String {
+        #if os(Linux)
+        let encoded = _addingPercentEncoding(withAllowedCharacters: HTTPData.formUrlencodedAllowedCharacters)
+        #else
+        let encoded = addingPercentEncoding(withAllowedCharacters: HTTPData.formUrlencodedAllowedCharacters)
+        #endif
+        return encoded?.replacingOccurrences(of: " ", with: "+") ?? ""
     }
     
     /// Percent-encodes everything except alphanumerics

    ///
    /// - Returns: Encoded string
    /// - SeeAlso: `func formUrlencode() -> String`
    func urlQueryEncode() -> String {
		return addingPercentEncoding(withAllowedCharacters: HTTPData.urlQueryAllowedCharacters) ?? ""
    }
}


extension String {
    struct HTTPData {
        // "0123456789ABCDEF"
        static let hexDigits: [CChar] = [48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 65, 66, 67, 68, 69, 70]
        
        static let formUrlencodedAllowedCharacters: CharacterSet = {
            var cs = CharacterSet()
            cs.insert(charactersIn:
                "0123456789" +
                "abcdefghijklmnopqrstuvwxyz" +
                "ABCDEFGHIJKLMNOPQRSTUVWXYZ" +
                "-._* ")
            return cs
        }()
        
        static let urlQueryAllowedCharacters: CharacterSet = {
            var cs = CharacterSet()
			cs.insert(charactersIn:
                "0123456789" +
                "abcdefghijklmnopqrstuvwxyz" +
                "ABCDEFGHIJKLMNOPQRSTUVWXYZ" +
                "-._~")
            return cs
        }()
    }
