Michal Suchanek <hramr...@centrum.cz> wrote:
> On 6 February 2010 15:23, Patric Mueller <bh...@gmx.net> wrote:
>> Michal Suchanek <hramr...@centrum.cz> wrote:
>>> FWIW here is a patch that
>>>
>>> a) tries to detect if user is running in utf-8 locale by a heuristic
>>> similar that that used in the autoconf test
>>
>> setlocale(LC_CTYPE, "") only sets the current LC_CTYPE to the value of
>> the user environment.
>>
>> If e.g. the user has LC_ALL=C the program will fail even if there is a
>> utf-8 locale it could use installed on the computer.
>
> Yes, and it's expected that users that want utf-8 output do have utf-8
> locale set so it just works in most cases.

But the utf-8 locale isn't only used for utf-8 output. As utf-8 is
used as internal standard encoding it is also used when e.g.
converting a latin1 or a shift_jis html file.

Requiring that the user has set an utf-8 locale for those cases is
unnecessary.

> So to use vilistextum in some odd build environment which runs in "C"
> locale but wants utf-8 output just specify an utf-8 locale as argument
> (and possibly build-depend on locales-all).

I don't think the problem lies in building. For building you need an
utf-8 locale otherwise the tests will fail and build-depend on
locales-all ensures that.

Moreover, IMO changing the behavior of 2.6.9 to differ from the ones
in OpenPKG, Gentoo and the official distribution isn't something a
package maintainer should do, if there is no serious need for it.

>> The attached patch first tries to set the locale found in the autoconf
>> script.
>>
>> If that fails, it popens 'locale -a' and searches for a working utf-8
>> locale to use.
>
> This is something I wanted to avoid because it requires parsing
> setlocale -a in the program and does not guarantee that a working
> locale is found.

But there is not much more parsing going on than with your patch. My
patch even uses the two method of yours that check if the locale is a
utf-8 locale.

If your patch finds a utf-8 locale, mine would too. But mine would
also in cases where the OS has a utf-8 locale but the user doesn't
want to use it.

> Still it should work in the common case either way.

I'm not sure that the not so common cases you're thinking of are that
rare. For example, my OS is completely utf-8 capable, but I prefer my
shell to be in latin1.

Nevertheless, IMO the finding-the-locale-at-runtime approach has a
bigger chance of just working in more cases with less user
intervention.

Bye
Patric

-- 
Homepage: http://bhaak.dyndns.org/
E-mail: bh...@gmx.net  Jabber: bh...@jabber.org  ICQ: 23653421
Languages: Deutsch, English
(Not fluently: Français, Italiano, Latinum)



--
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to