parse-lfs-message
Convert a Live for Speed message to UTF-8
This module is designed to be used with NodeJS on the server with xi4n or as middleware for other LFS InSim applications. This module will parse any LFS message (chat message, nickname, server name etc.), converting encoded Windows codepage characters to UTF-8. This module leaves message colour encodings intact for processing later.
Install
yarn add parse-lfs-message
npm i parse-lfs-message
Usage Example
You can run the example with yarn example
or npm run example
.
const parseLFSMessage = require("parse-lfs-message");
const msg1 = Buffer.from("^72^45 ^7B2^J^4Ï^1 Ayoub", "binary");
const msg2 = Buffer.from("^405 ^J¢^7ϧ^4£ ^7TJ", "binary");
const parsedMsg1 = parseLFSMessage(msg1);
const parsedMsg2 = parseLFSMessage(msg2);
console.log(parsedMsg1);
console.log(parsedMsg2);