Chellynne Bailey Posted June 20, 2018 Share Posted June 20, 2018 I'm working with HTTP_Requests and responses to a PHP page. In my LSL script, I'm comparing a bit of recieved data against a bit of stored data: if (a != b) llOwnerSay("Doesn't Match. We should have gotten " + a + " but we got " +b); if (a== b) llOwnerSay("Data Matches"); Buttt when I run it, this happens: Object: Doesn't Match. We should have gotten 929d44b65cdbba05af03b0c0b0ea4dc5 but we got 929d44b65cdbba05af03b0c0b0ea4dc5 If you notice, those strings are identical. But lsl says they are different. I've tried putting them both through llToLower and llEscapeURL, but they still don't come up as equal. Is there some sort of encoding issue I need to tackle to make this work? Link to comment Share on other sites More sharing options...
Rolig Loon Posted June 20, 2018 Share Posted June 20, 2018 Are you sure that they are both strings? Have you typecast them deliberately? 1 Link to comment Share on other sites More sharing options...
Chellynne Bailey Posted June 20, 2018 Author Share Posted June 20, 2018 Yip, I'd type cast them, sent them through llToLower, llEscapeURL, everything I could think of. I finally got them working when I sent them both through llStringTrim. Which is weird, cause neither appeared to have any trailing anything. But if it works, it works. Link to comment Share on other sites More sharing options...
Rolig Loon Posted June 20, 2018 Share Posted June 20, 2018 Hmmm.. It sounds like one of them has a formatting (non-printing) character in it. Or maybe a line feed? Link to comment Share on other sites More sharing options...
Chellynne Bailey Posted June 20, 2018 Author Share Posted June 20, 2018 5 minutes ago, Rolig Loon said: Hmmm.. It sounds like one of them has a formatting (non-printing) character in it. Or maybe a line feed? It's a distinct possibility. It is the first item in a list of data that's getting parsed out, so thats probably it. Link to comment Share on other sites More sharing options...
Innula Zenovka Posted June 20, 2018 Share Posted June 20, 2018 In case it is a non-printing character, then strTest = llStringTrim(strTest,STRING_TRIM) should get rid of those (you probably know this anyway, but others reading this thread in future might not). Link to comment Share on other sites More sharing options...
animats Posted June 20, 2018 Share Posted June 20, 2018 1 hour ago, Innula Zenovka said: In case it is a non-printing character, then strTest = llStringTrim(strTest,STRING_TRIM) should get rid of those (you probably know this anyway, but others reading this thread in future might not). Yes. Also, it's useful when printing arbitrary strings for debug purposes to enclose them in quote marks. If it came in from the web, there are lots of other things that can go wrong. Strings that aren't UTF-8. Malformed UTF-8. Line breaks which are CR LF. Anything that comes in from the web must be sanitized before use. Link to comment Share on other sites More sharing options...
Chellynne Bailey Posted June 20, 2018 Author Share Posted June 20, 2018 Yeah, as I said, I got it working when I shunted both through a llStringTrim A few minutes after posting this. Because of course you always find the solution as soon as you open your mouth to complain about it. Link to comment Share on other sites More sharing options...
Recommended Posts
Please take a moment to consider if this thread is worth bumping.
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now