I'm looking at making a universal battery charger. And I am interested in seeing whether I can get it to detect the chemistry so if a non rechargeable had been put in it won't charge.
Maxim has a good article on the subject. They also (surprise, surprise) have some ICs available to implement their functions.
The article talks mainly about using the Smart Battery System to control charging, but also has good info on how the different chemistries have different charging requirements. It doesn't discuss how to deal with an 'unknown' battery chemistry, so you may be out of luck.
You could consider putting a temperature sensor on the cell, but by the time the non-rechargeable cell gets hot it may already be too late. Also, a full alkaline will have a higher float voltage than a NiMH- or NiCd-equivalent (1.5V vs 1.2V) so you may be able to detect this and inhibit charging as well.
Here are some more articles to mention ...
Most reliable: - use separate battery pack with wire and connector - or single alkaline batteries in the same compartment
This completely differs the two chemistries