develooper Front page | perl.perl5.porters | Postings from April 2018

Re: [perl #133157] Solaris Failing Some Locale Tests

Thread Previous | Thread Next
From:
Karl Williamson
Date:
April 28, 2018 16:25
Subject:
Re: [perl #133157] Solaris Failing Some Locale Tests
Message ID:
1c573863-66ae-fbe3-18de-41f72244d4d4@khwilliamson.com
On 04/28/2018 10:02 AM, Karl Williamson wrote:
> On 04/27/2018 10:24 PM, Karl Williamson wrote:
>> On 04/27/2018 09:56 PM, Carlos Guevara wrote:
>>> Revised radix.c:
>>> #####
>>> #include <stdio.h>
>>> #include <locale.h>
>>>
>>> int
>>> main(int argc, char ** argv)
>>> {
>>>      unsigned char buf[100];
>>>      unsigned int i;
>>>
>>>      printf("%s\n", setlocale(LC_ALL, "ar_AE.UTF-8"));
>>>      snprintf(buf, sizeof(buf), "%g", 3.2);
>>>
>>>      for (i = 0; i < sizeof(buf); i++) {
>>>          if (buf[i] == '\0') break;
>>>          printf(" %x", buf[i]);
>>>      }
>>>      printf("\n");
>>> }
>>> #####
>>>
>>> Output:
>>> #####
>>> ar_AE.UTF-8
>>>   33 d9 32
>>> #####
>>>
>>
>> That should instead have been 33 d9 ab 32.
>> And that indicates that the problem is indeed with the OS.
>> My guess is that it doesn't consider the possibility of a multi-byte 
>> radix character, so it uses just the first byte, but \xd9 is a start 
>> byte of a two byte sequence, so this is leading to malformed UTF-8.
>>
>> I'll submit a trouble ticket for them.
>>
> 
> Now done as https://www.illumos.org/issues/9511
> 


Attached are three patches that cause these tests to pass on solaris.  A 
version specification should probably be added to the one for 
t/run/locale.t.  But there are complications that I don't know how to 
deal with.  I don't know the version spec to use for openindiana which I 
understand has a different kind of release deal.  And I don't know if 
this is a bug in the Oracle solaris, which has a very different version 
number.

I think these patches, after the versioning is ironed out, should go in 
5.28, so that this platform passes the test suite.  These affect only 
two .t files.

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About