use encoding constants

@bf4