move common char encoding up to Target; same works for Python.
Merge pull request #657 from parrt/factor-target

Factor target