From 52ad7b1fd5bca2a943de5b92eb03bdf3d5586cb8 Mon Sep 17 00:00:00 2001 From: mmorrison Date: Sat, 5 May 2018 03:31:25 -0500 Subject: [PATCH] Fix title encoding for fivem fixes #83 --- protocols/fivem.js | 1 + protocols/quake2.js | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/protocols/fivem.js b/protocols/fivem.js index 595346f..a7c708d 100644 --- a/protocols/fivem.js +++ b/protocols/fivem.js @@ -5,6 +5,7 @@ class FiveM extends require('./quake2') { super(); this.sendHeader = 'getinfo xxx'; this.responseHeader = 'infoResponse'; + this.encoding = 'utf8'; } finish(state) { diff --git a/protocols/quake2.js b/protocols/quake2.js index 0f5678d..4550cda 100644 --- a/protocols/quake2.js +++ b/protocols/quake2.js @@ -12,14 +12,14 @@ class Quake2 extends require('./core') { this.udpSend('\xff\xff\xff\xff'+this.sendHeader+'\x00', (buffer) => { const reader = this.reader(buffer); - const header = reader.string({length:4}); + const header = reader.string({length:4,encoding:'latin1'}); if(header !== '\xff\xff\xff\xff') return; let response; if(this.isQuake1) { response = reader.string({length:this.responseHeader.length}); } else { - response = reader.string(); + response = reader.string({encoding:'latin1'}); } if(response !== this.responseHeader) return;