0
我從服務器中獲取base64編碼的字符串。我把它解碼爲base64:Base64字符串解碼爲NSData並編碼爲UTF-8
DLog(@"parseing string to data: %@", value);
NSData *decodedData = [[NSData alloc] initWithBase64EncodedString:value options:0];
DLog(@"decoded value: %@", decodedData);
NSString *encodedString = [[NSString alloc] initWithData:decodedData encoding:NSUTF8StringEncoding];
DLog(@"encodedString: %@", encodedString);
登錄:
parseing string to data: UEsDBBQAAAAIACmEAUlpoChO7hYAAIHNBgAGABwAc20uZGJmVVQJAAMdwJ9XHcCfV3V4CwABBOcDAAAE5wMAAO2dzaokxxFGr5AX9sLv0N61wRSVWf...>
decoded value: <504b0304 14000000 08002984 014969a0 284eee16 000081cd 06000600 1c00736d 2e646266 55540900 031dc09f 571dc09f 5775780b 000104e7 03000004 e7030000...>
encodedString: (null)
但我的刺總是空。
爲什麼會發生這種情況?