The open source jar package cpdetector can automatically determine the content encoding of the current file, so as to select the correct encoding and reading when reading, avoiding the problem of garbled code.
Test results, screenshots provided:
GBK file content