Question

I'm trying to figure out if IA5STRING format (ASN.1) is actually equivalent to ASCII. That is, should I be able to do:

NSString *ia5StringWithDate = [[NSString alloc] initWithBytes:is5StringData length:is5StringLength encoding:NSASCIIStringEncoding];

Here is the context:

I'm working from this apple doc and from WWDC 2013 session "Using Receipts to Protect Your Digital Sales".

I've got most of my code worked out (untested yet!), but in attempting to actually pull out the in-app purchase portion of the receipt, the in-app purchase receipt field Purchase Date is described as being an RFC 3339 date. Given that I have an RFC 3339 date as an NSString, I think I've got a method to convert the NSString date to an NSDate (see How to format convert the string 2013-01-27T02:31:47+08:00 into NSDate). But, the format of the Purchase Date is given as IA5STRING (see this reference).

From the Wiki page for IA5STRING, it says "Those characters are generally equivalent to the first 128 characters of the ASCII alphabet". I don't like the sound of "generally".

This reference suggests that IA5STRING's are the same as ASCII.

Thoughts?

Thanks, Chris.

Was it helpful?

Solution

The character set for the ASN.1 IA5String is the first 128 characters of Unicode. This is the equivalent of US ASCII. The specific details can be seen in ITU-T Rec. X.680 which defines the IA5String type.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top