applying encoding