Rebase: import encoding directives

Rebase attempt of #16068
This is a non-trivial rebase and I'm not sure I got it right.
Some tests are failing in akka-http-core-experimental/test.
Perhaps we can look at those issues together, @sirthias ?