Fixed unicode keys in headers on 2.x

This fixes #452 and #758
Merge branch '0.9-maintenance'