use dynamic encoder