Replaced deprecated $KCODE with encoding declaration