In this video I go over how UTF-8 string encoding works and the branchless code I've come up with on how to extract the length of a UTF-8 string in C code. The code should be easily ported to anything like C++, golang, java, C#, etc. This video serves two fold as to explain the encoding of UTF-8 as it relates to the length of the encoded string as well as a concrete utf8 strlen function that anyone is free to use. I also showed how you can validate the string since that is tied directly to the length encoding that we go through. I typically don't mix my validation and implementation code, so those are separate but you should be able to easily combine them if you'd like. X ► Website ► GitHub ►











