From 3e260152cbf8fbd39c570a17c3a9cf637f2707c3 Mon Sep 17 00:00:00 2001 From: Erik Date: Mon, 16 Mar 2015 16:30:28 -0400 Subject: [PATCH] update for 1.2 --- SwiftIO/SocketFixUTF8.swift | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/SwiftIO/SocketFixUTF8.swift b/SwiftIO/SocketFixUTF8.swift index 0d10fcc..3d325e6 100644 --- a/SwiftIO/SocketFixUTF8.swift +++ b/SwiftIO/SocketFixUTF8.swift @@ -27,7 +27,7 @@ import Foundation var memoizer = [String: UnicodeScalar]() -func lookup(base:UnicodeScalar, combi:UnicodeScalar) -> UnicodeScalar { +private func lookup(base:UnicodeScalar, combi:UnicodeScalar) -> UnicodeScalar { let combined = "\(base)\(combi)" if let y = memoizer[combined] { @@ -54,13 +54,13 @@ func fixDoubleUTF8(inout name:String) { for ch in name.unicodeScalars { if ch.value < 0x80 { - y.append(UInt8(ch)) + y.append(UInt8(ch.value)) continue } isASCII = false if ch.value < 0x100 { - y.append(UInt8(ch)) + y.append(UInt8(ch.value)) continue } // might be a combining character that when combined with the @@ -77,7 +77,7 @@ func fixDoubleUTF8(inout name:String) { return } - y.append(UInt8(repl)) + y.append(UInt8(repl.value)) } if isASCII { @@ -92,7 +92,11 @@ func fixDoubleUTF8(inout name:String) { if let str = rslt.0 { if !rslt.hadError { name = str + } else { + println("error") } + } else { + println("error") } return