Просмотр исходного кода

Update HttpRequest.swift

supporting uploading with Chinese filename
Horst Leung 9 лет назад
Родитель
Сommit
02f061cc9f
1 измененных файлов с 3 добавлено и 3 удалено
  1. 3 3
      Sources/HttpRequest.swift

+ 3 - 3
Sources/HttpRequest.swift

@@ -124,16 +124,16 @@ public class HttpRequest {
     }
     
     private func nextMultiPartLine(_ generator: inout IndexingIterator<[UInt8]>) -> String? {
-        var result = String()
+        var temp = [UInt8]()
         while let value = generator.next() {
             if value > HttpRequest.CR {
-                result.append(Character(UnicodeScalar(value)))
+                temp.append(value)
             }
             if value == HttpRequest.NL {
                 break
             }
         }
-        return result
+        return String(bytes: temp, encoding: String.Encoding.utf8)
     }
     
     static let CR = UInt8(13)