dwdiff
the free dwdiff Unicode-aware
word-level diff with full CJK support, distributed as a
single self-contained static binary.
What it is
dwdiff is a word-level diff tool like
wdiff, but
Unicode-aware. The key difference shows up on CJK
text:
$ dwdiff -d ',' cn-a.txt cn-b.txt
体育老师无奈,[-总被佔课现象困扰-]{+总被占课现象困扰+}。
With the bundled ICU 78.3, dwdiff segments CJK phrases
correctly and surfaces intra-line character changes. Stock
wdiff would treat the whole CJK line as one
giant "word" and show it as a single delete+add.
Install (one line)
The fastest path uses x-cmd:
x eget ljh-sh/dwdiff
This installs dwdiff and the man page to
~/.local/bin/. See
install for the manual walkthrough.
Platform matrix
Every release builds 5 targets via GitHub Actions on native runners. Linux uses musl-static (Alpine toolchain) so the binary runs on Alpine, Debian/Ubuntu, RHEL/Fedora, Arch — every Linux distro — with zero system-library dependencies. There is intentionally no separate glibc/dynamic Linux variant.
| target | runner | linkage | archive |
|---|---|---|---|
x86_64-linux-musl | ubuntu-latest + Alpine 3.20 docker | fully static musl (incl. ICU) | .tar.gz |
aarch64-linux-musl | ubuntu-24.04-arm + Alpine 3.20 docker | fully static musl (incl. ICU) | .tar.gz |
aarch64-macos | macos-14 | static, system libc/libSystem | .tar.gz |
x86_64-macos | macos-14 (cross from aarch64) | static, system libc/libSystem | .tar.gz |
x86_64-windows | windows-latest + MSYS2 + mingw64 | fully static (no DLLs) | .zip |
aarch64-windows and additional targets are deferred.
Security
See security for the
source-level audit. The audit covers both vendored
upstreams — dwdiff 2.1.4 and ICU 78.3 —
and includes a CJK acceptance test that gates every
release: the build script's CJK round-trip fixture proves
ICU is actually linked in (without ICU, dwdiff's CJK output
is just [-整行-]{+整行+} with no intra-line
visibility).