简体   繁体   中英

iOS email encode with base 64

Hello I want to send social login email address to my server. So I am encoding it with base64 in this way.

NSString *encodedString = (NSString *)CFBridgingRelease(CFURLCreateStringByAddingPercentEscapes(NULL,(CFStringRef)dm.strAzureEmail,NULL,(CFStringRef)@"!*'();:@&=+$,/?%#[]",kCFStringEncodingUTF8 ));

My email address is like abctest@company.com . but from the server still I am getting the error

The input is not a valid Base-64 string as it contains a non-base 64 character, more than two padding characters, or an illegal character among the padding characters.

How can I encode it correctly. Please helpme. Thanks

 NSString *plainString = @"abctest@company.com";

 NSData *plainData = [plainStringdataUsingEncoding:NSUTF8StringEncoding];

 NSString *base64String = [plainData base64EncodedStringWithOptions:0]; 

 NSLog(@"%@", base64String);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM