Why in the fuck has this single call to a function in this one single case decided to append "13" to its output string...

@trickster I've sort of narrowed it down a bit. The problem is just as stupid though and just utterly bizarre.

When the string literal ends in an escape code like "\u20AC", it expands the escape into the right UTF-8, but appends the 1st and 3rd characters from the hex (the '2' and the 'A'). The "13" came from "\u1234".

Nothing in the code even begins to imply why on earth it might be doing that, but sure.

@OTheB the bug replication is more mistifying than the bug itself

@trickster @OTheB We don't question why it sucks, we just marvel at how the suck moves around and changes things. Take a step back, observe and appreciate the majesty of it all. Yup, there goes another server! The bug pops like popcorn. Mmmm.... popcorn. ;)

@trickster Fixed it! When the method to convert a string literal to data is iterating over the string, it only checked for an escape sequence at the start of the string, so the string started with \n and so always hopped forward in 2s, hence the 1st and 3rd characters from the sequence.

All because I wasn't slicing my array in the for loop, but only in the one place.

Sign in to participate in the conversation
Mastodon for Tech Folks

This Mastodon instance is for people interested in technology. Discussions aren't limited to technology, because tech folks shouldn't be limited to technology either!