我有一个 json 文件,我必须将其推送到 MongoDB 中。有不同编码的数据段。喜欢
{
"Type":"File",
"Start_Time":"2017-08-07T22:15:16.147Z",
"Finish_Time":"2017-08-07T22:15:16.147Z",
"Format":"UTF-16LE",
"Message":"*' ¾Ò ,'H EÌ1Ò (F\/Ò ©Ì -A'8* ©1H ,( *ÌF ('1 ~‘¾*'¾Ò *H'DDG ~'© A14* ",
"Name_DB":"Main"}
和
{
"Type":"File",
"Start_Time":"2017-08-07T22:16:51.462Z",
"Finish_Time":"2017-08-07T22:16:51.462Z",
"Format":"ASCII",
"Message":"SMS_CC_NR-InternType ISDN_NP +923330051108 From: UnkNumb Alphanumeric NR:EVC@ TID: 1123103757111462, Dear Retailer, U have successfully recharged 49 Rupee to 03325047863.Your current balance is 11257.00 Rupee.",
"Name_DB":"Main"
}
当我尝试读取文件时,它会引发编解码器错误。如您所见,这两个块具有不同的格式 -utf-16LE
和ASCII
.
我如何阅读这个文件?