The TXT format Configuration table cannot resolve the problem--bom

Source: Internet
Author: User
Tags first string

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.