working with encode