Today again encountered the same problem: planning to give a Txt Format Configuration table, I use the parsing class to read, the returned result is empty. The parsing class parameters are: Primary key key, file name filename, error hint errortip.
When writing a read statement, the primary key I was copied directly from the txt file, it is the first string of TXT file, the file name FileName The file name is also copied directly.
Since it is not the first time, this decision can no longer be ignored.
First in the parsing class to print, found that the other configuration table is normal, the read statement is printed in the key, looks exactly the same, but it is not recognized as the program read to the key is equal, Remember the last time I read the blog mentions Microsoft's Notepad will be in the document add marker symbols, so delete key and then hand, found that the same.
Back to read the statement, found to delete directly copied over theKeystring, when you are finished deletingKeycontent, you want to continue to delete theKey"symbol, the cursor is still in place, it is only found" after the symbol has an invisible character. SoGoogle Txtfile header information, learned that: when the text file encoding, the file header will be added to the byte order mark (Byte Order Mark), which identifies the encoding that the file is in that format. The general text editor is invisible (measured vim can be seen), because it is connected to the file header, so directly copy the text file at the beginning of the string will be copied together with this tag. Finally causes the text parsing class to judge the read statement to give theKeyparameters, which containBOM) is read from the parsing method of the text read in the class.Keyinconsistent.
Solution: The next time you write to read text statements, MO Lazy directly copy, you can manually knock. or copy it over, the cursor jumps to the string header to delete the invisible BOM.
PS: How to generate A text file without BOM:
1.notepad++ format bar has the option to convert to no BOM format.
2,Vim Open file can see the BOM file header deleted.
The TXT format Configuration table cannot resolve the problem--bom