Jin Kwon
Jin Kwon

Reputation: 21978

http header value safe characters

I have a method which encodes some key-value entries into an ASCII string with Percent-Encoding.

The result value is expected to be used as a http header value.

With following entries

("English", "love")
("한국어", "사랑")

The method generates

%ED%95%9C%EA%B5%AD%EC%96%B4=%EC%82%AC%EB%9E%91&English=love

Which looks like

key=value(&key=value)*
  1. Keys and values are encoded as Percent-Encoding
  2. Encoded key and value are concatenated with =.
  3. Pairs of encoded key and values are concatenated with &.

My question is, Is this output string can be used as http header field-value? Is there any problem or concern?

Upvotes: 0

Views: 579

Answers (1)

Julian Reschke
Julian Reschke

Reputation: 42017

As long you use printable US-ASCII, there shouldn't be a problem.

Upvotes: 1

Related Questions