simbroadcasts / node-insim

A NodeJS library for Live For Speed InSim protocol
https://simbroadcasts.github.io/node-insim/
13 stars 1 forks source link

Fix codepage conversion between LFS and Unicode #9

Closed mkapal closed 1 year ago

mkapal commented 2 years ago

Text strings don't seem to be coverted into Unicode correctly.

For example, if I type in a button dialog:

Input: ř Received: ^Eø Converted: ø

It is handled in BasePacket.ts:

if (typeof value === 'string' && value.length > 0) {
  value = parseLFSMessage(value);
}
PButcher commented 2 years ago

For reference (InSimDotNet):

https://github.com/alexmcbride/insimdotnet/blob/0406a0a6ba80267021d96e0bb8beb9696687bd22/InSimDotNet/LfsUnicodeEncoding2.cs

and

https://github.com/alexmcbride/insimdotnet/blob/0406a0a6ba80267021d96e0bb8beb9696687bd22/InSimDotNet/LfsUnicodeEncoding.cs

mkapal commented 1 year ago

Fixed by using parseLFSMessage to parse the binary buffer directly in jspack.js