A Better UTF-8 Automaton
TL;DR:
Any edge not shown goes to an error state.
Longer Read:
Some C code implementing the above DFA is as follows. An extra SYNC state is added to the state machine, which absorbs continuation bytes. Luckily we can overlap the bits of neighboring states, if the start of one matches the end of another.
Related Skills:
Software Design
💬 0 comments