Language detection with Google's Compact Language Detector 15 years ago
"You must provide it clean (interchange-valid) UTF-8, so any encoding issues must be sorted out before-hand."
In most cases you have to know the language in order to guess the encoding and convert to UTF-8 if necessary. Mutual recursion...