This appears to be a bug in Android from 4.3 onwards. There's a very good article on it here:
The author says that some people claim this is a feature rather than a bug, but I disagree. If encrypted data is about to be rendered unreadable the platform should at least inform the user, if not prevent them from proceeding altogether.