Ruby reads Chinese garbled code in txt after txt
In this case, the encoding of the text file is usually inconsistent with the system encoding. You need to figure out what the encoding of the text file is first, and then
File.read('your_file.txt', 'r:YOUR_ENCODING')