Re: NSCalendarDate and locale
Re: NSCalendarDate and locale
- Subject: Re: NSCalendarDate and locale
- From: Malte Tancred <email@hidden>
- Date: Mon, 28 Jan 2002 17:50:23 +0100
Joe Chan:
I'm using NSCalendarDate to parse a date string from a standard mail
header, and I'm trying to understand how locale comes into play. As I
understand (and I don't have much experience with non-US systems), the
date string in the Date field of mail header uses only short English
month and day names. If I used initWithString:calendarFormat: message
to parse the date string in a non-English system, those name won't
match. This suggests that I should use
initWithString:calendarFormat:locale: to specify the parsing to be done
with an English locale. My question is: how do I get an English locale
dictionary on a non-English system? As far as I can see in
NSUserDefaults, I can only easily get the user's current default, not
perhaps a named one.
Just a thought that doesn't answer your question, but it
might be worth something...
I don't know how well NSCalendarDate handles the format of
the Date message header. A good document describing many
variations of the header is available here:
http://cr.yp.to/immhf/date.html
Perhaps it would be better to write the header parsing
code yourself and then use NSCalendarDate, especially
considering the following statement from the link above:
"One can in principle insert extra spaces, tabs, and
comments into a timestamp, like any other tokenizable
field value:
Mon (Lundi), 4(quatre)May (Mai) 1998(1998-05-04)03 : 04 : 12 +0000
"
I'm not sure NSCalendarDate handles RFC822 header field
comments like the above. Perhaps I'm wrong.
Cheerio,
Malte
--
Malte Tancred
Computer programmer, Oops AB, Sweden
mailto:email@hidden
http://www.oops.se/