Emoji
-
이모지와 유니코드 그리고 자바개발 나누고 더하기/자바, 스프링 2023. 4. 22. 00:09
발단 2021년 어느날 회사 서비스의 DB 컬레이션을 utf8mb4로 수정하였다. 회사 내 다른 서비스와 상품 연동을 하는데, 이 채널로부터 4bytes 이모지가 포함된 상품 데이터를 받아 해당 상품 페이지의 이모지가 다 깨져 나왔기 때문이다. 우리는 DB 컬레이션만 수정하면 되는데 문제는 우리와 상품 연동을 하는 또 제 3의 서비스에서 이모지 허용이 안되는 것이 문제였다. 이모지를 걸러서 전송해야 하는데 2가지 방향으로 문제를 풀 수 있다. 화이트 리스트를 만들어 이 안에 포함된 문자만 허용하거나 블랙 리스트를 만들어 그 안에 든 문자들을 제거하는 것이다. 그 당시 이 문제를 담당했던 개발자는 전자를 택하여 아래와 같은 코드가 나왔다. public class EmojiUtil { private stat..