File tree Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Original file line number Diff line number Diff line change 26
26
import Foundation
27
27
28
28
func fixDoubleUTF8( inout name: String ) {
29
- let utf8 = name. dataUsingEncoding ( NSISOLatin1StringEncoding) !
30
- let latin1 = NSString ( data: utf8, encoding: NSUTF8StringEncoding) !
31
- name = latin1 as String
29
+ if let utf8 = name. dataUsingEncoding ( NSISOLatin1StringEncoding) ,
30
+ latin1 = NSString ( data: utf8, encoding: NSUTF8StringEncoding) {
31
+ name = latin1 as String
32
+ }
32
33
}
33
34
34
35
func do ubleEncodeUTF8 ( inout str: String) {
35
- let latin1 = str. dataUsingEncoding ( NSUTF8StringEncoding) !
36
- let utf8 = NSString ( data: latin1, encoding: NSISOLatin1StringEncoding) !
37
- str = utf8 as String
36
+ if let latin1 = str. dataUsingEncoding ( NSUTF8StringEncoding) ,
37
+ utf8 = NSString ( data: latin1, encoding: NSISOLatin1StringEncoding) {
38
+ str = utf8 as String
39
+ }
38
40
}
You can’t perform that action at this time.
0 commit comments