I have a Tab Separated Value file that I need to import in mongodb
I do
mongoimport -d mydb -c blsItem --type tsv --file .\BLS_3.01.txt --fieldFile .\fieldnames-bls.txt
fieldname-bls.txt contains all the keys nicely separated in an UTF-8 file:
blsKey
germanDescription
englishDescription
The result of the import is, that every blsKey starts with glibberish
{ "_id" : ObjectId("4eee82136e6ffebe9085debd"), "´╗┐blsKey" : "B100000", "germanDescription" : "Vollkornbrote", "englishDescription" : ""
But even VIM shows the “fieldname-bls.txt” nice and clean.
What is going on?
It looks like UTF-8 BOM. Convert your file into UTF-8 without BOM, that’s it.