I'm currently developing theme for Textual IRC and I want to compare the "Topic is ..." messages to the topic displayed in the channels topic bar, to delete them if the are the same.
The topic that causes problems has both Umlaute and a URI in it and looks like the following:
++ Frische Austern ++ Nächste Sitzung: https:/some/uri/that/can/contain/umlaute" ++
When I print both the old topic and the new topic, they look exactly the same, down to the trailing and leading whitespaces (I used trim()
to eliminate them).
The comparison is done with
if(oldTopic === newTopic){
// do stuff
}
What I've tried so far
Typecheck
I used typeof
to make sure both them are of the type string and not Object
Umlaut elimination
I used replace(/ä/g, 'ae')
to eliminate the Umlaute
URL Elimination
I used replace(/\//g, '_')
to get rid of the forward slashes
I used escape()
to escape non unicode characters
Unfortunately none of it worked. Again if I use console.log
to show the two strings, they are exactly the same. I was expecting some Unicode stuff, that you can represent ä in different ways, but replacing it didn't work either.
I've tried but I reached my limit of my JavaScript knowledge. I have really no idea why it's not working. The code has worked on some other topics, that did neither involve any Umlaute nor an URL.
If any of you happens to know an answer I'd be very thankful.
Kind regards and thanks in advance!