tags:

views:

32

answers:

2

It seems the header value is always encoded as "ISO8859-1".

A: 

it is possible. read here: http://www.ietf.org/rfc/rfc2047.txt

briefly. you write in header: =?UTF-8?B?0YTRi9Cy?=, where UTF-8 is encoding, B is for Base64 (may be Q for quoted-pritable), 0YTRi9Cy is actual encoded data (here some text in Russian)

encoded-word = "=?" charset "?" encoding "?" encoded-text "?="

charset = token ; see section 3

encoding = token ; see section 4

token = 1*

especials = "(" / ")" / "<" / ">" / "@" / "," / ";" / ":" / " <"> / "/" / "[" / "]" / "?" / "." / "="

encoded-text = 1* ; (but see "Use of encoded-words in message ; headers", section 5)

Andrey
called a MIME Encoded Word - http://en.wikipedia.org/wiki/MIME#Encoded-Word
Chris Diver
@Chris Diver i prefer RFC over wikipedia :)
Andrey
I do too, just a different perspective. I hate wikipedia for the fact you can't trust what you read, but at the same time it provides some great information. But RFCs can take a long time to read and interpret. They can be difficult to understand if you don't have a certain level of knowledge.
Chris Diver
why this was downvoted?
Andrey
RFC 2047 isn't used in practice, so won't have any effect unless you control sender and receiver. The right answer depends on the actual header; unfortunately there is no generic answer.
Julian Reschke
@Julian Reschke you are wrong, it is standard. you can never control sender and receiver. this is the generic way different encodings are transfered via headers.
Andrey
Andrey, if you believe I'm wrong you may want to bring this issue up in the HTTP(bis) Working Group. Furthermore, yes, there are cases where you can control server and client (Subversion comes to mind).
Julian Reschke
A: 

It depends on the header.

As far as I can tell, there is no interoperable support for RFC 2047 encoding in HTTP headers, nor is it clear from RFC 2616 where it could be allowed.

The new HTTP spec won't mention RFC 2047 encoding anymore (see Ticket 111).

For headers that use parameters (such as Content-Type or Content-Disposition), the encoding defined in RFC 2231 can be an alternative.

Julian Reschke