Add const overload for encoding

Now that it is not overloaded for other reasons we can add the const
overload back without having to worry much about which overload/
specialization will be matched.