解码未知格式

时间:2016-03-15 05:34:21

标签: node.js text encoding character-encoding escaping

设置:Nodejs服务器从pc com端口获取数据

在我收到以下文本流的pc serial com端口读取数据时: <13> 27HF [13; 27H [1mF [22m] [27m [13; 31H44 [13; 31H [1m44] [22m [27m [13; 37H] [22m [27m [13; 37H] [13; 46HPTORDR [13; 46H [1mPTORDR [22m [27m [13; 55HCR [13; 55H [1mCR] [22m [27m [13; 62HF419152 [13; 62H [1mF419152] [22m [27m [13; 75HSL [13; 75H [1mSL [22m [27m] [ 24; 00H [2K%CHANGE_CLASS,班级变更 - 需要背书[22m [27m

是否可以对此消息进行编码/解码?

1 个答案:

答案 0 :(得分:1)

这些是ANSI转义码。您可以使用node-ansiparser