Basic Authorization issue with backslash in username using Objec

Registration date
Friday August 14, 2015
Last seen
October 7, 2015
- Aug 19, 2015 at 08:07 AM
I am working on a Iphone application and I am using basic authorization in my https request. In this application I am working with backslash "\" in username using Objective C. But it is not working correctly as it is giving an unauthorized 401 error. I am using the following code :

NSString *authStr = [NSString stringWithFormat:@"%@:%@", @"p5\test", @"password"];
NSData *authData = [authStr dataUsingEncoding:NSUTF8StringEncoding];
NSString *base64String = [authData base64EncodedStringWithOptions:0];
NSString *authValue = [NSString stringWithFormat:@"Basic %@", base64String];
NSDictionary *data=@{@"Authorization":authValue};

I have doubt might be username with backslash creating problem. I have viewed few iphone developer forum to read about basic authorization issue, but my doubt is still not cleared. Can anyone help me if I am doing anything wrong with the code.