On Wed, Apr 10, 2013 at 05:56:51AM -0500, Vladimir Támara Patiño wrote:
> The attached test fails (in 5.2, 5.3 and current), producing:
> 
> locale es_CO.UTF-8/es_CO.UTF-8/C/C/C/es_CO.UTF-8
> __mb_cur_max=4
> locale es_CO.ISO8859-1/es_CO.ISO8859-1/C/C/C/es_CO.ISO8859-1
> __mb_cur_max=1
> locale es_CO.UTF-8/es_CO.UTF-8/C/C/C/es_CO.UTF-8
> __mb_cur_max=1
> assertion "__mb_cur_max == 4" failed: file "prob_mb_cur_max.c", line 21,
> function "main"
> 
> The attached patch fixes the problem.

Thanks! I will try to get this committed, possibly with some cleanup.

> By the way, in FreeBSD the structure xlocale_ctype has a member
> __mb_cur_max, and __mb_cur_max for UTF-8 is 6.

The longest UTF-8 character used to be 6 bytes long but this was
restricted to 4 bytes later. See RFC 3629.
 
>  int
> +_citrus_ctype_mb_cur_max(char const *encname)
> +{
> +     if (strcmp(encname, "UTF8") == 0) {
> +             return _CITRUS_UTF8_MB_CUR_MAX;
> +     }
> +     return 1;  // If not UTF8 then single byte encoding

No C++ comments, please!

Reply via email to