Boost C++ Libraries: Ticket #7788: locale_data::parse could be simplified https://svn.boost.org/trac10/ticket/7788 <p> (If there's another way to submit patches, please do tell. :)) </p> <p> So I've written this patch that simplifies locale_data::parse greatly. </p> <p> Pitfalls: </p> <p> <strong>It does allow invalid locale names</strong> like (en.UTF-8@eruo_US) to be parsed in to its correct components, but since it's an internal API that doesn't seem to matter. </p> <p> It's now case-sensitive. <strong>Which required a change in the unit tests to pass.</strong> It'd be trivial to fix this (one line of code when appending the character), but I personally desire this behaviour as it means I can get out what I put in to Boost.Locale via my code. It doesn't seem to break anything and the unit tests and/or documentation for the most part don't indicate it's important. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/7788 Trac 1.4.3 anonymous Tue, 11 Dec 2012 16:07:41 GMT attachment set https://svn.boost.org/trac10/ticket/7788 https://svn.boost.org/trac10/ticket/7788 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">locale_data.patch</span> </li> </ul> Ticket 166291@… Tue, 11 Dec 2012 18:13:39 GMT attachment set https://svn.boost.org/trac10/ticket/7788 https://svn.boost.org/trac10/ticket/7788 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">new_patch.patch</span> </li> </ul> Ticket 166291@… Tue, 11 Dec 2012 18:16:18 GMT <link>https://svn.boost.org/trac10/ticket/7788#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/7788#comment:1</guid> <description> <p> I added another patch which eliminates both the pitfalls, and is a bit more complex but still less redundant than the original code. </p> <p> I would like to know why case sensitivity is a factor though. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Artyom Beilis</dc:creator> <pubDate>Fri, 21 Dec 2012 14:49:26 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/7788#comment:2 https://svn.boost.org/trac10/ticket/7788#comment:2 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">invalid</span> </li> </ul> <p> Several notes: </p> <ol><li>You can't use toupper or isalpha as they are locale sencitive and may accept characters outside of ASCII scope </li><li>It does not the same, for example, the code allows to accept "-" and language-country separator </li></ol><p> The code is so complex because it tries to do the best to guess the locale </p> <blockquote class="citation"> <p> It does allow invalid locale names </p> </blockquote> <p> This is <em>very important</em> part, many OSes do very crazy stuff, so I try to guess as much as I can. </p> <p> Sorry I can't accept this patch. </p> <p> If you can improve the code readability and maintainablility without changing the scope if this function feel free to reopen this ticked and submit a new patch. </p> <p> Thanks for your effort. </p> Ticket