Set ext and src encoding from -K flag.

Fixes #480.