Implement a custom Qt text codec using UTF-8 that automatically falls back to Latin-1 upon encountering invalid UTF-8 bytes. This is what most web browsers do, according to Wikipedia.