From: Michal Suchanek Date: 2008-01-02T02:36:02+09:00 Subject: Re: locale in ruby On 01/01/2008, Dave Thomas wrote: > > On Jan 1, 2008, at 9:07 AM, Michal Suchanek wrote: > > > If ruby is supposed to work wit any encoding and in any locale it > > should not use locale dependent functions. > > > Just a quick sanity check: are we convinced that the cure is less > painful than the disease? > What do you mean here? For you it might be. If you know only languages that happen to fit into iso-8859-1 and never intend to learn anything more exotic (or work for people who know anything more exotic) you are fine when using the POSIX locale. However, the error here was that Ruby in the core functioanlity uses a libc function that behaves differently in different locale. This is a poor choice in two ways. First this function fails if sumebody tries to use ruby in an application that is aware of locale. Second this function does more than we want, and is needlessly complex. Similarily you might ask if it's necessary to have dynamically sized buffers. If you never used string larger than, say 4K, why not limit the size to a static value, and allocate as a C array? It makes stuff oh so much easier! BTW this is used for pathnames quite a lot because on most systemas there is PATH_MAX. Thanks Michal