Pang-bô͘:UTF-8/1

Wikipedia (chū-iû ê pek-kho-choân-su) beh kā lí kóng...

00

Documentation icon Pang-bô͘ bûn-kiāⁿ

If the number passed is less than 128, then this is a one byte sequence - return the value; otherwise, it's the last byte of a multi-byte sequence, and you add the 6 least significant bits to 0x80.