<font face="Verdana,Arial,Helvetica,sans-serif" size="2">Hi there, <div><br></div><div>I've hit an obstacle while working on a crash seen in initing a Calendar (<a href="https://bugs.swift.org/browse/SR-2551)" target="_blank">https://bugs.swift.org/browse/SR-2551)</a><br><font face="Verdana,Arial,Helvetica,sans-serif" size="2"><font><font><div class="socmaildefaultfont" dir="ltr"><div class="socmaildefaultfont" dir="ltr"><div class="socmaildefaultfont" dir="ltr"><div dir="ltr" style="font-style: normal;"><br></div><div dir="ltr" style="font-style: normal;">For the Calendar initialiser "<span class="syntax-keyword" style="box-sizing: inherit; font-family: Menlo, monospace; font-size: 14px; text-indent: -23.111167907714844px;"><font color="#aa0d91">init</font></span><span style="font-family: Menlo, monospace; font-size: 14px; text-indent: -23.111167907714844px; background-color: rgb(249, 250, 250);"><font color="#333333">(</font></span><span class="syntax-identifier" style="box-sizing: inherit; font-family: Menlo, monospace; font-size: 14px; text-indent: -23.111167907714844px;">identifier</span><span style="font-family: Menlo, monospace; font-size: 14px; text-indent: -23.111167907714844px; background-color: rgb(249, 250, 250);"><font color="#333333">: </font></span><span class="syntax-type" style="box-sizing: inherit; font-family: Menlo, monospace; font-size: 14px; text-indent: -23.111167907714844px;"><font color="#5c2699">Calendar</font></span><span style="font-family: Menlo, monospace; font-size: 14px; text-indent: -23.111167907714844px; background-color: rgb(249, 250, 250);"><font color="#333333">.</font></span><span class="syntax-type" style="box-sizing: inherit; font-family: Menlo, monospace; font-size: 14px; text-indent: -23.111167907714844px;"><font color="#5c2699">Identifier</font></span><span class="syntax-type" style="box-sizing: inherit; font-family: Menlo, monospace; font-size: 14px; text-indent: -23.111167907714844px; background-color: rgb(249, 250, 250);"><font color="#333333">)", </font></span>the possible values of Calendar.Identifier are listed <a target="_blank" href="https://developer.apple.com/reference/foundation/calendar.identifier" title="https://developer.apple.com/reference/foundation/calendar.identifier">here</a>. However, we eventually end up calling "<span class="pl-en" style="box-sizing: border-box; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px; white-space: pre;"><font color="#795da3">_CFCalendarInitWithIdentifier</font></span><span style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px; white-space: pre;"><font color="#333333">(</font></span><span class="pl-c1" style="box-sizing: border-box; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px; white-space: pre;"><font color="#0086b3">CFCalendarRef</font></span><span style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px; white-space: pre;"><font color="#333333"> calendar, </font></span><span class="pl-c1" style="box-sizing: border-box; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px; white-space: pre;"><font color="#0086b3">CFStringRef</font></span><span style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px; white-space: pre;"><font color="#333333"> identifier)" </font></span>and the latter works only for a specific set of calendar identifiers. See this if statement:</div><div dir="ltr" style="font-style: normal;"> <a href="https://github.com/apple/swift-corelibs-foundation/blob/master/CoreFoundation/Locale.subproj/CFCalendar.c#L239" target="_blank">https://github.com/apple/swift-corelibs-foundation/blob/master/CoreFoundation/Locale.subproj/CFCalendar.c#L239</a><br></div><div dir="ltr" style="font-style: normal;"><br></div><div dir="ltr" style="font-style: normal;">For other identifier values, we crash (that is SR-2551). On mac, all the identifier values are supported. It seems that the calendar identifier is ultimately encoded as a key-value pair in the locale ID for the calendar. </div><div dir="ltr" style="font-style: normal;"><br></div><div dir="ltr" style="font-style: normal;">Can anybody please help me understand the rationale of the if-statement above? I am new to ICU. I did search for justifications but didn't come across convincing. <br></div><div dir="ltr" style="font-style: normal;"><br></div><div dir="ltr" style="font-style: normal;">Thanks!</div><div dir="ltr" style="font-style: normal;"><span style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px; white-space: pre;"><font color="#333333"><br></font></span></div><div dir="ltr" style="font-style: normal;"><font face="Sans Serif, Verdana, Arial, Helvetica, sans-serif">Pushkar N Kulkarni,</font></div>
<div dir="ltr" style="font-style: normal;"><font face="Sans Serif, Verdana, Arial, Helvetica, sans-serif">IBM Runtimes</font></div><div dir="ltr" style="font-style: normal;"><font face="Sans Serif, Verdana, Arial, Helvetica, sans-serif"><br></font></div><div dir="ltr"><font face="serif, Times New Roman, Times, serif"><i>Simplicity is prerequisite for reliability - Edsger W. Dijkstra</i></font></div>
<div dir="ltr" style="font-style: normal; font-size: 10.5pt; font-family: Arial;"><br></div></div></div></div></font></font></font></div></font><BR>