Is the result of reading one line of the file a string?

I used file in node to read the ini file, but comparing the value of the readable line is not correct

var val1 = "[PATH]".localeCompare(msg.payload);    // val1 = -1
var val2 = "[PATH]" === msg.payload;               // val2 = false

[{"id":"f822faf5.cc3ea8","type":"file in","z":"aa40b590.ff1888","name":"","filename":"/Temp/Test.ini","format":"lines","chunk":false,"sendError":false,"encoding":"Shift_JIS","x":1500,"y":2420,"wires":[["d7be30e5.716ed"]]},{"id":"9cab729f.2d89f","type":"inject","z":"aa40b590.ff1888","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"str","x":1330,"y":2360,"wires":[["f822faf5.cc3ea8"]]},{"id":"d7be30e5.716ed","type":"debug","z":"aa40b590.ff1888","name":"result","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1630,"y":2500,"wires":[]}]

How the comparison is please just help me!
Thanks.

Trying comparing against msg.payload.trim() - that will remove the extra whitespace (my guess, a \r as you're on windows) that you can see in the Debug side view as.

1 Like

@knolleary Thank you very much!^^

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.