News for hackers. Stuff that matters.
Re:UTF-8 Everywhere (2012) by Avernar on Monday June 20, 2016 @03:15AM (#11936568)
> I get your point, it just doesn't apply to many real world situations I've seen where you don't have the luxury of just using a higher level language or a library that takes care of all these things

No, I still think your missing some of it. I am not advocating that what I said is the solution for everything.

Someone said that slicing UTF-8 strings leads to string corruption and endorsed the Python 3 frankenstien unicode type as a way to avoid it. I just gave a way of preventing that.

Now you argued that a novice programmer would fail to implement it properly. So you're comparing my method implemented by a novice programmer to a method implemented by profesional compiler writers. That hardly seems fair. :)

So my argument is that if my method were to be implemented by professional compiler writers it would prevent corrupted strings while still using UTF-8 as the internal representation.

> I basically undid all his changes, and wrapped all COBOL string splicing to call a function that always split a string at a valid position - truncating invalid bytes at the start/end as necessary.

> luckily for them they'd accidentally hired someone who had done lots of multilingual programming before.

So an expert programmer implemented a string splitting function that didn't corrupt strings. :D

> but even you made a mistake in your first example of what to do

I writing this on an iPad while watching TV and playing a game on another android tablet while looking at the wikipedia UTF-8 article on a tiny phone screen while a little white dog is trying to bite my fingers (wish I was making this up). Not exactly my usual programming environment. ;)

Re:UTF-8 Everywhere (2012) by imron on Monday June 20, 2016 @03:34AM (#11936620)
> Now you argued that a novice programmer

sigh if only it was novice programmers making these mistakes :-/

Re:UTF-8 Everywhere (2012) by Avernar on Monday June 20, 2016 @03:54AM (#11936689)
Upvote for that comment.

The stuff I've seen in some people's multithreaded code just makes me want to cry.