Detect charset from headers