Nobuyoshi,

Thanks, your solution is really more Ruby-way. I just wonder why 
"setlocale" isn't a part of Ruby standard library. Since Ruby maps/wraps 
most of the standard (POSIX) functions (especially those available on 
Windows too), this one should be also taken into consideration.

> First of all, option after // is GNU iconv local extension.
Sure I know that, but it doesn't mean it is EVIL, is it? Still it is 
very useful for creating permalinks and removing accented characters 
simply, w/o using any third party libraries and so, but unusable until 
we call POSIX setlocale, which isn't present in Ruby API.

> Second, extconf.rb must check for the necessary header, and
> whether each categories are defined.

Still it should be present on every system (AFAIK it is), since quoting 
man: "The setlocale() function conforms to ISO/IEC 9899:1999 (``ISO 
C99'').". Is there anyone who checks whether <stdio.h> exists?

> And it feels too redundant.  I guess Locale.ctype = '' would be easy.

Sure yours is better. Mine didn't consider fact that some of constants 
may have different values on different systems.

If it is was to be included into standard library I'd leave 
Locale::setlocale method as well, as you may combine types there and 
also check returned value, where nil means failed association and String 
on successful one, where documentation doesn't explicitly say that 
returned string is exactly the one that was passed. So with simple 
Locale::ctype= we may miss some important feedback.

Cheers,
Adam.
-- 
Posted via http://www.ruby-forum.com/.