diff --git a/libraries/base/tests/IO/all.T b/libraries/base/tests/IO/all.T
index 92cb93add5c684d3235ff92d039e691b3a99346d..31a250ca0549e08592cbec8af7ae002529f36dc4 100644
--- a/libraries/base/tests/IO/all.T
+++ b/libraries/base/tests/IO/all.T
@@ -119,7 +119,17 @@ test('encoding001', [], compile_and_run, [''])
 
 test('encoding002', normal, compile_and_run, [''])
 test('encoding003', normal, compile_and_run, [''])
-test('encoding004', [extra_files(['encoded-data/']), js_broken(22374)], compile_and_run, [''])
+test('encoding004', [extra_files(['encoded-data/']), js_broken(22374),
+# wasi-libc doesn't have cp936, see
+# https://gitlab.haskell.org/ghc/wasi-libc/-/blob/main/libc-top-half/musl/src/locale/iconv.c#L38
+# and
+# https://gitlab.haskell.org/ghc/wasi-libc/-/blob/main/libc-top-half/musl/src/locale/codepages.h
+# for locales supported by wasi-libc's iconv implementation
+when(arch('wasm32'), skip),
+# MacOS Sonoma iconv() has a regression that causes this test to fail on the
+# CP936 roundtrip. See the ticket for related issues in other projects.
+when(opsys('darwin'), fragile(24161))
+], compile_and_run, [''])
 test('encoding005', normal, compile_and_run, [''])
 
 test('environment001', [], makefile_test, ['environment001-test'])