added support for date (D) and logic (L) field types

also pass the encoding to the header