This paper is concerned with the resilient distributed state estimation issue for smart grids under probabilistic encoding-decoding scheme and randomly occurring deception attacks. Due to the constraints of communication resources, a novel encoding-decoding method is adopted to probabilistically transform the original signals into specific codewords for facilitating the transmission of measurements. The randomly occurring deception attacks, which jeopardize the transmission via malicious data infiltration, are determined by a set of Bernoulli-distributed variables with a specified probability. The purpose of this paper is to develop an encoding-decoding-based distributed state estimation scheme tailored to smart grids against deception attacks and gain disturbance. The upper bound on the estimation error covariance is firstly guaranteed via matrix analysis technique, and subsequently is minimized by designing appropriate gain matrix. Furthermore, a matrix simplification approach is introduced specifically to tackle the issue of sparsity in sensor network topologies. Finally, simulation experiments based on IEEE 39-bus system are provided to validate the feasibility of the proposed encoding-decoding-based resilient distributed estimation scheme for smart grids.