[ticket/11711] Improve coding and comments of character check

PHPBB3-11711