I have this Base64 decoding code in place -
--
(NSString *)DecodeBase64:(NSString *)Value; {
//Return the decoded Base64 string. string must be multiple of 4 chars in length
NSUInteger paddedLength = Value.length + (4 - (Value.length % 4));
NSString *paddedBase64 = [Value stringByPaddingToLength:paddedLength withString:@"=" startingAtIndex:0];
NSData *decodedData = [[NSData alloc] initWithBase64EncodedString:paddedBase64 options:NSDataBase64DecodingIgnoreUnknownCharacters];
NSString *decodedString = [[NSString alloc] initWithData:decodedData encoding:NSUTF8StringEncoding];
return decodedString;
}
--
Decode of this string -
PD94bWwgdmVyc21vbj0iMS4wIiBlbmNvVGluZz0i
returns this string -
<?xml versmon="1.0" encoTing="
which appears incorrect, misspell of "version" and "encoding" - 2 incorrect characters.
The source string comes form a very large government body so I don't imagine that it is not correct...
Is there some problem with the code?