Use inspect on key name so handle keys with invalid encoding