ICU: Add an encoding detection function