1.背景
因为需要windows下进行flink测试,于是在windows下开启kafka,然后拷贝一段数据,使用comsole去发送数据,此时发现数据在解析的时候报错
org.apache.flink.shaded.jackson2.com.fasterxml.jackson.core.JsonParseException: Invalid UTF-8 middle byte 0xc0
at [source: (byte[])"( "fileName": "user","eventCount": "1", "srcPort": "32691","deviceName": "192.168.84.23", "deviceId": "12345604", " responseCode": "400","destAddress": "10.1.1.22","destHostName": "172.16.101.164", "srcGeoLongitude":"-95.71289",
"srcGeoLatitude": "37 .09024","deviceCat": "/Audit", "eventId":"5409001249409249025", " srcGeoCity": "б","srcAddress": "20.1.1.6",
"srcGeoCountry":"ẞ00↓","productvendorName": "ẞ"
大概是中文乱码,但是有个我首先觉得是编码问题,于是我把数据保存在txt文档中,并且保存的时候设置UTF-8编码,发现不行。(这个在我同事那里挺好用的)。
然后我将cmd黑窗口设置utf-8,发现也不可以。修改编码参考:https://jingyan.baidu.com/article/d621e8da6565ba2864913f47.html