git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v2 1/1] gettext: always use UTF-8 on native Windows

From
Junio C Hamano <gitster@pobox.com>
Date
Jul 8, 2019, 18:30 UTC
Message-ID
<xmqq8st8z8da.fsf@gitster-ct.c.googlers.com>
In-Reply-To
<87o92976nz.fsf@evledraar.gmail.com>
Ævar Arnfjörð Bjarmason <avarab@gmail.com> writes:
Show 10 quoted lines
>> -#	ifdef HAVE_LIBCHARSET_H
>> +#	ifdef GIT_WINDOWS_NATIVE
>> + ... new windows-only code ...
>> +#	elif defined HAVE_LIBCHARSET_H
>>  #		include <libcharset.h>
>>  #	else
>>  #		include <langinfo.h>
> ...
> It looks to me that with this patch the HAVE_LIBCHARSET_H docs in
> "Makefile" become wrong. Shouldn't those be updated too?

I do not think this change has much to do with HAVE_LIBCHARSET_H; it inserts "regardless of what we have been doing, do this new thing only and always on windows (persumably '... because libcharset would not be useful on that platform')".

Existing users of HAVE_LIBCHARSET_H and existing non-windows users that did not use HAVE_LIBCHARSET_H are not affected, and whatever Makefile documents the macro as still applies to them.

Show 5 quoted lines
> I wonder if it wouldn't be better to always compile this function, and
> just have init_gettext_charset() switch between the two. We've moved
> more towards that sort of thing (e.g. with pthreads). I.e. prefer
> redundant compilation to ifdefing platform-only code (which then only
> gets compiled there). See "HAVE_THREADS" in the code.

OK, so init_gettext_charset() is the only caller of locale_charset() in our codebase, and we supply our own locale_charset() if we do not have <libcharset.h>, either with nl_langinfo(), or with the code introduced by the patch in question for windows. Your suggestion is to add a block of #ifdef cascade in init_gettext_charset() to call locale_charset(), nl_langinfo(), or the windows-only code (perhaps inlined right there)?

I am not sure. We'd need the conditional inclusion of header files depending on HAVE_LIBCHARSET_H etc. anyway, so...

Previous: Johannes Schindelin
Message 9 of 9 in “gettext(windows): always use UTF-8”
  1. 0/1 gettext(windows): always use UTF-8Johannes Schindelin via GitGitGadget, Jun 27, 2019
  2. 1/1 gettext: always use UTF-8 on native WindowsKarsten Blees via GitGitGadget, Jun 27, 2019
  3. Johannes SchindelinJul 3, 2019
  4. Junio C HamanoJul 3, 2019
  5. 0/1 gettext(windows): always use UTF-8Johannes Schindelin via GitGitGadget, Jul 3, 2019
  6. 1/1 gettext: always use UTF-8 on native WindowsKarsten Blees via GitGitGadget, Jul 3, 2019
  7. Ævar Arnfjörð BjarmasonJul 4, 2019
  8. Johannes SchindelinJul 8, 2019
  9. Junio C HamanoJul 8, 2019

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.