Write encoding to kDebug() only if it is detected.