  We present a scheme for encoding and decoding an unknown state for CSS codes,
based on syndrome measurements. We illustrate our method by means of Kitaev
toric code, defected-lattice code, topological subsystem code and Haah 3D code.
The protocol is local whenever in a given code the crossings between the
logical operators consist of next neighbour pairs, which holds for the above
codes. For subsystem code we also present scheme in a noisy case, where we
allow for bit and phase-flip errors on qubits as well as state preparation and
syndrome measurement errors. Similar scheme can be built for two other codes.
We show that the fidelity of the protected qubit in the noisy scenario in a
large code size limit is of $1-\mathcal{O}(p)$, where $p$ is a probability of
error on a single qubit. Regarding Haah code we provide noiseless scheme,
leaving the noisy case as an open problem.
