Pustur/whatsapp-chat-parser

New format includes a special character between the time and PM / AM

Closed this issue · 2 comments

Pustur commented

From an email I received:

Hey, you're amazing for creating this tool, so thanks from New York.

But although the example file works perfectly, none of my exports work :-(
I dragged and dropped, and even used file explorer to choose it directly. What am I doing wrong?

I edited the text file only to replace names, didn't touch anything else.

The text chat attached:

1/4/23, 7:02 PM - Messages and calls are end-to-end encrypted. No one outside of this chat, not even WhatsApp, can read or listen to them. Tap to learn more.
2/2/23, 2:51 AM - Person 2: <Media omitted>
2/4/23, 10:02 PM - Person 2: <Media omitted>
2/4/23, 10:35 PM - Person 1: Got it. So is it 4:30 or 6?
2/4/23, 10:35 PM - Person 2: It was changed
2/4/23, 10:35 PM - Person 2: Time change!
2/4/23, 10:35 PM - Person 1: K, I'll be there around 6 bz"h
2/4/23, 10:35 PM - Person 2: Great see you then!

The problem is a Narrow No-Break Space used between the time and AM / PM.

I am also facing this issue, the parser gives empty chats, waiting for the fix to this issue

A Temporary solution would be using the following function to replace the special character with space,

/**
 * Replace unicode white space with white space
 *
 * @param text string
 * @return string
 */
export function replaceSpace(text: string) {
  return text.replace(/\u202F/g, " ");
}

Use this function on chat string before passing to parser function.