tolower function problem

Possibly a Unicode character in a session without UTF-8 encoding. Can't say more without knowing the content of CRC$doc_text. See the FAQ: How to do a minimal reproducible example reprex for beginners