Why not have `getEncoding()` raise an exception when the value is empty? That would allow you to remove it from the constructor, and resolve the need to check for an encoding each time it's needed (you'd simply say `$enc = $this->getEncoding()`, and it would raise an exception if not set).