hex-agon / chat-logger

A plugin for RuneLite's Plugin Hub
BSD 2-Clause "Simplified" License
7 stars 10 forks source link

Should logger replace NBSP with normal space? #22

Open allisonkong opened 1 year ago

allisonkong commented 1 year ago

Here's what's happening:

  1. In the chatbox, if a character name has a space in it, the game prints it using using U+00A0 (non breaking space) rather than the usual U+0020 space.
  2. Chat logger logs this verbatim, which is a reasonable behavior (as it's exactly what the game printed). However, this makes it quite annoying to search chat logs in grep/vim/etc because U+00A0 doesn't match U+0020.

As an example, I isolated a line from one of my logs:

$ cat example.txt
10:55:00 To Small�Luna: Test
$ hexdump example.txt
0000000 3031 353a 3a35 3030 5420 206f 6d53 6c61
0000010 a06c 754c 616e 203a 6554 7473 0a0d
000001e

Which translates to this: image (ignore the endian-ness - the main thing to note is the use of 0xA0 inside "Small Luna")

What do you think about simply replacing all U+00A0 with U+0020 in the log output?

allisonkong commented 1 year ago

I'm happy to work on this if you think it's a good idea fwiw.

hex-agon commented 1 year ago

Hmm, ChatEntry already handles this somewhat (although it seems to be missing from sender), seems like it is an oversight and should be handled before entries get logged. You can use the Text class to standardize the player names.

fatfingers23 commented 1 year ago

I'm going to look at solving this tonight. Pretty sure this was my fault with #12 . Whoops.

OsrsMerchant commented 1 year ago

I don't think this was ever fixed? It's still adding some odd squares instead of spaces for me

j5ryMuQ