LNA Web Application Server

FAQ

[WAS] Response Header에 charset=ISO-8859-1가 자동 지정되어 한글깨짐 현상 발생

  • 2020-05-31 21:26
  • 05-31 21h

[이슈]

Response Header에 charset=ISO-8859-1가 자동 지정되어 한글깨짐 현상 발생

[현상]

Response에 한글깨짐 현상이 발생하며 Response Header에

Content-Type : charset=utf-8;charset=ISO-8859-1

와 같은 값이 존재함.

[원인]

Servlet 소스 레벨에서 response.setContentType(“charset=utf-8”) 과 같이 mime type을 기술하지 않으면, Engine 레벨에서 default charset인 ISO-8859-1을 append함.

[해결방안]

Response.setContentType(“text/html;charset=utf-8”) 과 같이 mime type과 charset을 같이 기술하면 (http/1.1 spec에 의거) 정상적으로 처리됨

<참고>

https://www.w3.org/Protocols/HTTP/1.1/rfc2616.pdf

3.7 Media Types

HTTP uses Internet Media Types [17] in the Content-Type (section 14.17) and Accept (section 14.1) header fields in order to provide open and extensible data typing and type negotiation. media-type = type "/" subtype *( ";" parameter ) type = token subtype = token

Parameters MAY follow the type/subtype in the form of attribute/value pairs (as defined in section 3.6).

The type, subtype, and parameter attribute names are case-insensitive. Parameter values might or might not be casesensitive, depending on the semantics of the parameter name. Linear white space (LWS) MUST NOT be used between the type and subtype, nor between an attribute and its value. The presence or absence of a parameter might be significant to the processing of a media-type, depending on its definition within the media type registry.

Note that some older HTTP applications do not recognize media type parameters. When sending data to older HTTP applications, implementations SHOULD only use media type parameters when they are required by that type/subtype definition.

Media-type values are registered with the Internet Assigned Number Authority (IANA [19]). The media type registration process is outlined in RFC 1590 [17]. Use of non-registered media types is discouraged.