consistent use of UTF8 Strings instead of ASCII. AuthenticationProvider to deal with self-certifying servers (NSURLAuthenticationMethodServerTrust). The build script uses 1 parameter (Debug or Release) for building. If you upgraded to the latest version of XCode - please clean the build directory. You may also have to clear the precompiled header cache.

git-svn-id: https://svn.apache.org/repos/asf/chemistry/objectivecmis/trunk@1477571 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/ObjectiveCMIS/Bindings/AtomPub/CMISObjectByIdUriBuilder.m b/ObjectiveCMIS/Bindings/AtomPub/CMISObjectByIdUriBuilder.m
index d20c6f7..11abd75 100644
--- a/ObjectiveCMIS/Bindings/AtomPub/CMISObjectByIdUriBuilder.m
+++ b/ObjectiveCMIS/Bindings/AtomPub/CMISObjectByIdUriBuilder.m
@@ -69,7 +69,7 @@
         urlString = [NSString stringWithFormat:@"%@&returnVersion=%@", urlString, returnVersionParam];
     }
 
-    return [NSURL URLWithString:[urlString stringByAddingPercentEscapesUsingEncoding:NSASCIIStringEncoding]];
+    return [NSURL URLWithString:[urlString stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];
 }
 
 @end
\ No newline at end of file
diff --git a/ObjectiveCMIS/Bindings/AtomPub/CMISObjectByPathUriBuilder.m b/ObjectiveCMIS/Bindings/AtomPub/CMISObjectByPathUriBuilder.m
index 08d3fe1..3d86de3 100644
--- a/ObjectiveCMIS/Bindings/AtomPub/CMISObjectByPathUriBuilder.m
+++ b/ObjectiveCMIS/Bindings/AtomPub/CMISObjectByPathUriBuilder.m
@@ -48,7 +48,7 @@
     urlString = [urlString stringByReplacingOccurrencesOfString:@"{includeACL}" withString:(self.includeACL ? @"true" : @"false")];
     urlString = [urlString stringByReplacingOccurrencesOfString:@"{renditionFilter}" withString:(self.renditionFilter != nil ? self.renditionFilter : @"")];
 
-    return [NSURL URLWithString:[urlString stringByAddingPercentEscapesUsingEncoding:NSASCIIStringEncoding]];
+    return [NSURL URLWithString:[urlString stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];
 }
 
 
diff --git a/ObjectiveCMIS/Common/CMISStandardAuthenticationProvider.m b/ObjectiveCMIS/Common/CMISStandardAuthenticationProvider.m
index ce17816..ee4472e 100644
--- a/ObjectiveCMIS/Common/CMISStandardAuthenticationProvider.m
+++ b/ObjectiveCMIS/Common/CMISStandardAuthenticationProvider.m
@@ -71,10 +71,12 @@
     if ([authenticationMethod isEqualToString:NSURLAuthenticationMethodClientCertificate] && self.credential.identity) {
         return YES; // client certificat requested and certificate identity available
     }
+    if ([authenticationMethod isEqualToString:NSURLAuthenticationMethodServerTrust]) {
+        return YES;
+    }
     if ([authenticationMethod isEqualToString:NSURLAuthenticationMethodHTTPBasic] && self.credential.user && self.credential.hasPassword) {
         return YES; // basic authentication requested and username & password available
     }
-    
     return NO;
 }
 
@@ -99,6 +101,9 @@
         } else if (challenge.proposedCredential) {
             CMISLogDebug(@"Authenticating with proposed credential");
             [challenge.sender useCredential:challenge.proposedCredential forAuthenticationChallenge:challenge];
+        } else if([challenge.protectionSpace.authenticationMethod isEqualToString:NSURLAuthenticationMethodServerTrust]){
+            [challenge.sender useCredential:[NSURLCredential credentialForTrust:challenge.protectionSpace.serverTrust] forAuthenticationChallenge:challenge];
+            [challenge.sender continueWithoutCredentialForAuthenticationChallenge:challenge];
         } else {
             CMISLogDebug(@"Authenticating without credential");
             [challenge.sender continueWithoutCredentialForAuthenticationChallenge:challenge];
diff --git a/ObjectiveCMIS/Utils/CMISBase64Encoder.m b/ObjectiveCMIS/Utils/CMISBase64Encoder.m
index 3968862..1ea5dd3 100644
--- a/ObjectiveCMIS/Utils/CMISBase64Encoder.m
+++ b/ObjectiveCMIS/Utils/CMISBase64Encoder.m
@@ -27,7 +27,7 @@
 
 +(NSString *)stringByEncodingText:(NSData *)plainText
 {
-    NSString *result = [[NSString alloc] initWithData:[self dataByEncodingText:plainText] encoding:NSASCIIStringEncoding];
+    NSString *result = [[NSString alloc] initWithData:[self dataByEncodingText:plainText] encoding:NSUTF8StringEncoding];
     return result;
 }
 
diff --git a/ObjectiveCMIS/Utils/CMISHttpRequest.h b/ObjectiveCMIS/Utils/CMISHttpRequest.h
index 4160786..436d9a7 100644
--- a/ObjectiveCMIS/Utils/CMISHttpRequest.h
+++ b/ObjectiveCMIS/Utils/CMISHttpRequest.h
@@ -23,7 +23,7 @@
 #import "CMISRequest.h"
 @class CMISAuthenticationProvider;
 
-@interface CMISHttpRequest : NSObject <NSURLConnectionDataDelegate, CMISCancellableRequest>
+@interface CMISHttpRequest : NSObject <NSURLConnectionDelegate, NSURLConnectionDataDelegate, CMISCancellableRequest>
 
 @property (nonatomic, assign) CMISHttpRequestMethod requestMethod;
 @property (nonatomic, strong) NSURLConnection *connection;
diff --git a/ObjectiveCMIS/Utils/CMISURLUtil.m b/ObjectiveCMIS/Utils/CMISURLUtil.m
index b7790c4..4b9c047 100644
--- a/ObjectiveCMIS/Utils/CMISURLUtil.m
+++ b/ObjectiveCMIS/Utils/CMISURLUtil.m
@@ -41,7 +41,7 @@
     // Append param
     [result appendString:parameterName];
     [result appendString:@"="];
-    [result appendString:[parameterValue stringByAddingPercentEscapesUsingEncoding:NSASCIIStringEncoding]];
+    [result appendString:[parameterValue stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];
 
     return result;
 }
diff --git a/build_universal_lib.sh b/build_universal_lib.sh
index 1bbf6e5..963022f 100755
--- a/build_universal_lib.sh
+++ b/build_universal_lib.sh
@@ -17,7 +17,16 @@
 
 BUILD_UNIVERSAL_LIB='TRUE'
 export BUILD_UNIVERSAL_LIB
-xcodebuild -project ObjectiveCMIS.xcodeproj -target ObjectiveCMIS -configuration Debug clean build
+
+if [[ "$1" == "Debug" ]] ; then
+   BUILD_CONFIG=Debug
+   echo "Building debug version of universal library..."
+else
+   BUILD_CONFIG=Release
+   echo "Building release version of universal library..."
+fi
+
+xcodebuild -project ObjectiveCMIS.xcodeproj -target ObjectiveCMIS -configuration $BUILD_CONFIG clean build
 
 appledoc --project-name ObjectiveCMIS --project-company "Apache Chemistry" --company-id org.apache.chemistry.opencmis --output ./ObjectiveCMISHelp --keep-intermediate-files --exit-threshold 2 --keep-undocumented-objects --keep-undocumented-members --ignore .m --ignore ObjectiveCMISTests .