sitelink1 | |
---|---|
sitelink2 | |
sitelink3 | |
sitelink4 | |
sitelink5 | |
sitelink6 |
/**
* 입력받은 스트링에서 BOM을 제거한다
* @param str
* @return
*/
public static String removeUTF8BOM(String str) {
// FEFF because this is the Unicode char represented by the UTF-8 byte order mark (EF BB BF).
if (str.startsWith("uFEFF")) {
str = str.substring(1);
}
return str;
}
참고사항 : BOM은 다음과 같은 형태가 존재한다. (모든 UTF형태의 문서에서 BOM검사를 수행하려면 다음을 참고한다.)
00 00 FE FF UTF-32, big-endian
FF FE 00 00 UTF-32, little-endian
FE FF UTF-16, big-endian
FF FE UTF-16, little-endian
EF BB BF UTF-8
FF FE 00 00 UTF-32, little-endian
FE FF UTF-16, big-endian
FF FE UTF-16, little-endian
EF BB BF UTF-8