add encoding in magic