12. Given
$$
\sin (x+\sin x)=\cos (x-\cos x),
$$

where, $x \in[0, \pi]$. Then $x=$ $\qquad$
12. $\frac{\pi}{4}$.

The original equation is equivalent to
$$
\cos \left(\frac{\pi}{2}-x-\sin x\right)=\cos (x-\cos x).
$$

Then $x-\cos x=2 k \pi+\frac{\pi}{2}-x-\sin x(k \in \mathbf{Z})$,
or $x-\cos x=2 k \pi-\left(\frac{\pi}{2}-x-\sin x\right)(k \in \mathbf{Z})$.
From equation (1), we get
$$
2 x+\sin x-\cos x=2 k \pi+\frac{\pi}{2},
$$

and the function
$$
f(x)=2 x+\sin x-\cos x
$$

is increasing on $[0, \pi]$. Therefore,
$$
-1=f(0)<2 k \pi+\frac{\pi}{2}<f(\pi)=2 \pi+1.
$$

This gives $k_{r}=0$.
Thus, $2 x+\sin x-\cos x=\frac{\pi}{2} \Rightarrow x=\frac{\pi}{4}$.
From equation (2), we get
$$
\begin{array}{l}
\sin x+\cos x=\frac{\pi}{2}-2 k \pi \\
\Rightarrow 1<\frac{\pi}{2}-2 k \pi<\sqrt{2},
\end{array}
$$

which is a contradiction.