**** The variable coding-system-for-write, if non-nil, specifies the
coding system to use for writing a file, or for output to a synchronous
subprocess.
It also applies to any asynchronous subprocess or network connection, but in a different way: the value of coding-system-for-write when you start the subprocess or connection affects that subprocess or connection permanently or until overridden.
The variable coding-system-for-write takes precedence over file-coding-system-alist, process-coding-system-alist and network-coding-system-alist, and all other methods of specifying a coding system for output. But most of the time this variable is nil. It exists so that Lisp programs can bind it to a specific coding system for one operation at a time.