I have been attempting to finalize my trash byte verification process. This will fix all problems with checking trash bytes in the current version. Here is what I have so far:
Going in reverse order (last byte to first byte) check for an ending FF FF (terminator pair). To distinguish between a terminator pair and trash bytes, all bytes before the terminator pair (even another terminator pair), must be a valid Korean or Non-Korean character.
If there is a pair of bytes that are not a valid character, then you start from that terminator pair and keep going until you find another terminator pair. If no terminator pair is found, then its invalid. If a terminator pair is found, then the above is checked again.
If all characters are valid and a terminator pair has been found, then the text follows one of two sets: Korean or Non-Korean. If it contains korean characters, then it is definitely korean, otherwise it is still either one.
Check every part of the visible name to make sure those characters fall into the proper font table.
Next check the OT Name the same way. If there are korean characters then it is definitely korean, otherwise it can still be either one.
If it has korean characters then check for a NICKNAMED flag, and check for korean trash bytes. All pass, then its valid.
If it does not have korean characters, then check every country's trash bytes to see if one or more are valid. Only check for korean trash bytes if it has a nicknamed flag.
Then check the OT Name for proper trash bytes according to the valid trash bytes found above.
Did I miss anything in my analysis?
I would also like to thank Eevee aka Veekun and his minions for his PokeDex info. I stole it to facilitate the comprehensive checking of legality checker.