Hacker News new | ask | show | jobs
by Sir_Cmpwn 3944 days ago
The C code there fails if the unicode string includes characters whose width is greater than one octet.
1 comments

Which is noted right in the post:

> This treats things as byte-array instead of unicode, thus for unicode test it will end up printing just 車賈滑豈.

Which is useless then, because the output can't safely be considered a string anymore. I don't really see the point of writing the C "equivalent" and giving it any point when it doesn't even do the right thing.
None of the snippets comes even remotely close to doing the right thing so it doesn't really matter.