{"thread":{"id":"64778","subject":"[PATCH v2 2/2] utf8.c: Enable workaround for iconv under macOS 14/15","startedAt":"2026-01-11T19:52:00Z","lastAt":"2026-01-11T19:52:00Z","messageCount":1,"participants":["tboegi@web.de"],"isPatch":true,"patchVersion":2,"patchTotal":2},"messages":[{"id":"533542","messageId":"20260111195151.716191-1-tboegi@web.de","threadId":"64778","inReplyTo":null,"subject":"[PATCH v2 2/2] utf8.c: Enable workaround for iconv under macOS 14/15","fromName":"","fromEmail":"tboegi@web.de","sentAt":"2026-01-11T19:51:51Z","receivedAt":"2026-01-11T19:52:00Z","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 a MacOS version is used that has a buggy\niconv library and there is no external library provided\n(and linked against) from neither MacPorts nor Homebrew nor Fink.\nFor Homebrew, MacPorts and Fink we check if libiconv exist.\nNote that a fresh installation on Fink now defaults to /opt/sw,\nso check the new path (only).\n\nSigned-off-by: Torsten Bögershausen <tboegi@web.de>\n---\n Makefile         | 16 ++++++++++++++++\n config.mak.uname |  1 +\n 2 files changed, 17 insertions(+)\n\ndiff --git a/Makefile b/Makefile\nindex b7eba509c6..8aa489f3b6 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -1687,11 +1687,21 @@ ifeq ($(uname_S),Darwin)\n \t\t\tBASIC_CFLAGS += -I/sw/include\n \t\t\tBASIC_LDFLAGS += -L/sw/lib\n                 endif\n+                ifeq ($(shell test -d /opt/sw/lib && echo y),y)\n+\t\t\tBASIC_CFLAGS += -I/opt/sw/include\n+\t\t\tBASIC_LDFLAGS += -L/opt/sw/lib\n+\t\t\tifeq ($(shell test -e /opt/sw/lib/libiconv.dylib && echo y),y)\n+\t\t\t\tHAS_GOOD_LIBICONV = Yes\n+\t\t\tendif\n+                endif\n         endif\n         ifndef NO_DARWIN_PORTS\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\tifeq ($(shell test -e /opt/local/lib/libiconv.dylib && echo y),y)\n+\t\t\t\tHAS_GOOD_LIBICONV = Yes\n+\t\t\tendif\n                 endif\n         endif\n         ifndef NO_APPLE_COMMON_CRYPTO\n@@ -1714,6 +1724,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 +1870,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"}]}