Possible hint here… It may have something to do with text encodings. Internally if created as such strings are supposed to remain UTF-8 regardless of operations, however in my cocoa development work (utterly unrelated, this was a serial communications app), I’d found that the encoding would occasionally change under the hood for no explicable reason, leading to having characters appended to strings. This would show up on transferring hardware buffer contents of the port to child properties of the class, doing binary mid / left / right string operations, etc. My guess is the OS X string class api’s themselves are glitchy. The only reliable solution I’ve found has been to force the text encoding prior to each write and after each read from any string variable in order to ensure it didn’t change internally as a result of the call.
That’s an astute hint. I’m so paranoid about character encoding…it’s always my mental go-to when it comes to this sort of thing. I am a big fan of reading (and re-reading) this article once (or twice) a year. Thanks for reminding me. It could be a problem with encoding, but I don’t really think that is what is going on in this case…but I would NOT be shocked if it was.
My guess is the OS X string class api’s themselves are glitchy.
This part I fully suspect you are right about…now for more digging.
Oh yeah. The Joel rant on Unicode. “Six months peeling onions in a submarine”. Used that quote at the office more times than I can count in reference to certain programmers at a fruit flavored computer manufacturer.
I’ve often thought if Joel ran the world we’d be in far better shape.