{"thread":{"id":"64752","subject":"[PATCH v1 2/2] utf8.c: Enable workaround for iconv under macOS 14/15","startedAt":"2026-01-08T17:40:16Z","lastAt":"2026-01-09T18:01:18Z","messageCount":2,"participants":["tboegi@web.de","René Scharfe"],"isPatch":true,"patchVersion":1,"patchTotal":2},"messages":[{"id":"533296","messageId":"20260108174012.471706-1-tboegi@web.de","threadId":"64752","inReplyTo":null,"subject":"[PATCH v1 2/2] utf8.c: Enable workaround for iconv under macOS 14/15","fromName":"","fromEmail":"tboegi@web.de","sentAt":"2026-01-08T17:40:12Z","receivedAt":"2026-01-08T17:40:16Z","isPatch":true,"sender":{"key":"tboegi@web.de","avatar":"https://avatars.githubusercontent.com/u/7138363?v=4"},"body":"From: Torsten Bögershausen <tboegi@web.de>\n\nThe previous commit introduced a workaround in utf8.c to deal\nwith broken iconv implementations.\n\nIt is enabled when\n  A MacOS version is used that has a buggy iconv library and\n  there is no external library provided (and linked against)\n  from neither MacPorts nor Homebrew.\n\nSigned-off-by: Torsten Bögershausen <tboegi@web.de>\n---\n Makefile         | 7 +++++++\n config.mak.uname | 1 +\n 2 files changed, 8 insertions(+)\n\ndiff --git a/Makefile b/Makefile\nindex b7eba509c6..5a3823bb67 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -1692,6 +1692,7 @@ ifeq ($(uname_S),Darwin)\n                 ifeq ($(shell test -d /opt/local/lib && echo y),y)\n \t\t\tBASIC_CFLAGS += -I/opt/local/include\n \t\t\tBASIC_LDFLAGS += -L/opt/local/lib\n+\t\t\tHAS_GOOD_LIBICONV = Yes\n                 endif\n         endif\n         ifndef NO_APPLE_COMMON_CRYPTO\n@@ -1714,6 +1715,7 @@ endif\n ifdef USE_HOMEBREW_LIBICONV\n ifeq ($(shell test -d $(HOMEBREW_PREFIX)/opt/libiconv && echo y),y)\n \tICONVDIR ?= $(HOMEBREW_PREFIX)/opt/libiconv\n+\tHAS_GOOD_LIBICONV = Yes\n endif\n endif\n endif\n@@ -1859,6 +1861,11 @@ ifndef NO_ICONV\n                 endif\n \t\tEXTLIBS += $(ICONV_LINK) -liconv\n         endif\n+        ifdef NEEDS_GOOD_LIBICONV\n+        ifndef HAS_GOOD_LIBICONV\n+                BASIC_CFLAGS += -DICONV_RESTART_RESET\n+        endif\n+        endif\n endif\n ifdef ICONV_OMITS_BOM\n \tBASIC_CFLAGS += -DICONV_OMITS_BOM\ndiff --git a/config.mak.uname b/config.mak.uname\nindex 38b35af366..3c35ae33a3 100644\n--- a/config.mak.uname\n+++ b/config.mak.uname\n@@ -157,6 +157,7 @@ ifeq ($(uname_S),Darwin)\n         endif\n         ifeq ($(shell test \"$(DARWIN_MAJOR_VERSION)\" -ge 24 && echo 1),1)\n \t\tUSE_HOMEBREW_LIBICONV = UnfortunatelyYes\n+\t\tNEEDS_GOOD_LIBICONV = UnfortunatelyYes\n         endif\n \n \t# The builtin FSMonitor on MacOS builds upon Simple-IPC.  Both require\n-- \n2.50.0.rc0.46.g7014b55638.dirty\n\n"},{"id":"533397","messageId":"0a5c058c-e5cb-41c9-8788-6dc6354f9119@web.de","threadId":"64752","inReplyTo":"20260108174012.471706-1-tboegi@web.de","subject":"Re: [PATCH v1 2/2] utf8.c: Enable workaround for iconv under macOS 14/15","fromName":"René Scharfe","fromEmail":"l.s.r@web.de","sentAt":"2026-01-09T18:01:10Z","receivedAt":"2026-01-09T18:01:18Z","isPatch":true,"sender":{"key":"l.s.r@web.de","avatar":"https://avatars.githubusercontent.com/u/26122331?v=4"},"body":"On 1/8/26 6:40 PM, tboegi@web.de wrote:\n> From: Torsten Bögershausen <tboegi@web.de>\n> \n> The previous commit introduced a workaround in utf8.c to deal\n> with broken iconv implementations.\n> \n> It is enabled when\n>   A MacOS version is used that has a buggy iconv library and\n>   there is no external library provided (and linked against)\n>   from neither MacPorts nor Homebrew.\n\nOdd style.  Make \"A\" lowercase, remove the line break after \"when\" and\nunindent?\n\n> Signed-off-by: Torsten Bögershausen <tboegi@web.de>\n> ---\n>  Makefile         | 7 +++++++\n>  config.mak.uname | 1 +\n>  2 files changed, 8 insertions(+)\n> \n> diff --git a/Makefile b/Makefile\n> index b7eba509c6..5a3823bb67 100644\n> --- a/Makefile\n> +++ b/Makefile\n> @@ -1692,6 +1692,7 @@ ifeq ($(uname_S),Darwin)\n>                  ifeq ($(shell test -d /opt/local/lib && echo y),y)\n>  \t\t\tBASIC_CFLAGS += -I/opt/local/include\n>  \t\t\tBASIC_LDFLAGS += -L/opt/local/lib\n> +\t\t\tHAS_GOOD_LIBICONV = Yes\n\nThis doesn't check whether libiconv was actually installed via MacPorts,\nso technically that's more of a \"Maybe?\", no?\n\n>                  endif\n>          endif\n>          ifndef NO_APPLE_COMMON_CRYPTO\n> @@ -1714,6 +1715,7 @@ endif\n>  ifdef USE_HOMEBREW_LIBICONV\n>  ifeq ($(shell test -d $(HOMEBREW_PREFIX)/opt/libiconv && echo y),y)\n>  \tICONVDIR ?= $(HOMEBREW_PREFIX)/opt/libiconv\n> +\tHAS_GOOD_LIBICONV = Yes\n\nLooks good.\n\n>  endif\n>  endif\n>  endif\n> @@ -1859,6 +1861,11 @@ ifndef NO_ICONV\n>                  endif\n>  \t\tEXTLIBS += $(ICONV_LINK) -liconv\n>          endif\n> +        ifdef NEEDS_GOOD_LIBICONV\n> +        ifndef HAS_GOOD_LIBICONV\n\n\"GOOD\" is quite vague.  There's already ICONV_OMITS_BOM, and I wouldn't\nbe surprised if we discover the need for some other workarounds soon.\nHow about naming the make variables after the C macro to be more clear\nand specific?\n\nCan we get away with a single make variable?  Set it in config.mak.uname\non affected systems and set it to empty if we detect that a 3rd party\nlibiconv is used?\n\n> +                BASIC_CFLAGS += -DICONV_RESTART_RESET\n> +        endif\n> +        endif\n>  endif\n>  ifdef ICONV_OMITS_BOM\n>  \tBASIC_CFLAGS += -DICONV_OMITS_BOM\n> diff --git a/config.mak.uname b/config.mak.uname\n> index 38b35af366..3c35ae33a3 100644\n> --- a/config.mak.uname\n> +++ b/config.mak.uname\n> @@ -157,6 +157,7 @@ ifeq ($(uname_S),Darwin)\n>          endif\n>          ifeq ($(shell test \"$(DARWIN_MAJOR_VERSION)\" -ge 24 && echo 1),1)\n>  \t\tUSE_HOMEBREW_LIBICONV = UnfortunatelyYes\n> +\t\tNEEDS_GOOD_LIBICONV = UnfortunatelyYes\n>          endif\n>  \n>  \t# The builtin FSMonitor on MacOS builds upon Simple-IPC.  Both require\n\n"}]}