A proof-of-principle demonstration of a one-way polarization encoding quantum key distribution (QKD) system is demonstrated. This approach can automatically compensate for birefringence and phase drift. This is achieved by constructing intrinsically stable polarization-modulated units (PMUs) to perform the encoding and decoding, which can be used with four-state protocol, six-state protocol, and the measurement-device-independent (MDI) scheme. A polarization extinction ratio of about 30 dB was maintained for several hours over a 50 km optical fiber without any adjustments to our setup, which evidences its potential for use in practical applications.