Recently, Gottesman et al (2001 Phys. Rev. A 64, 012310) showed how to encode a qubit into a continuous variable quantum system. This encoding was realized by using non-normalizable quantum codewords, which therefore can only be approximated in any real physical set-up. Here we show how a neutral atom, falling through an optical cavity and interacting with a single mode of the intracavity electromagnetic field, can be used to safely encode a qubit into its external degrees of freedom. In fact, the localization induced by a homodyne detection of the cavity field is able to project the near-field atomic motional state into an approximate quantum codeword. The performance of this encoding process is then analysed by evaluating the intrinsic errors induced in the recovery process by the approximated form of the generated codeword.