소스 검색

Merge pull request #1 from fattomhk/upload-chinese-name

Update HttpRequest.swift
Horst Leung 9 년 전
부모
커밋
24a2134eb8
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)