유니코드
-
이모지와 유니코드 그리고 자바개발 나누고 더하기/자바, 스프링 2023. 4. 22. 00:09
발단 2021년 어느날 회사 서비스의 DB 컬레이션을 utf8mb4로 수정하였다. 회사 내 다른 서비스와 상품 연동을 하는데, 이 채널로부터 4bytes 이모지가 포함된 상품 데이터를 받아 해당 상품 페이지의 이모지가 다 깨져 나왔기 때문이다. 우리는 DB 컬레이션만 수정하면 되는데 문제는 우리와 상품 연동을 하는 또 제 3의 서비스에서 이모지 허용이 안되는 것이 문제였다. 이모지를 걸러서 전송해야 하는데 2가지 방향으로 문제를 풀 수 있다. 화이트 리스트를 만들어 이 안에 포함된 문자만 허용하거나 블랙 리스트를 만들어 그 안에 든 문자들을 제거하는 것이다. 그 당시 이 문제를 담당했던 개발자는 전자를 택하여 아래와 같은 코드가 나왔다. public class EmojiUtil { private stat..
-
혼자 공부하는 컴퓨터구조 + 운영체제 - 컴퓨터 구조 기본책책책 책을 읽읍시다/프로그래밍 2023. 1. 15. 00:37
저자 : 강민철 들어가며 만 7년된 개발자이지만 부끄럽게도 컴퓨터 구조와 운영체제쪽은 잘 몰라 위기감에 사 읽은 책이다. 고수준 언어인 자바는 JVM이 OS별로 인터프리팅해주므로 운영체제니 CPU 레지스터니 하는 영역은 몰라도 되는줄 알았다. 대학생 때 광고홍보학과를 복수 전공했는데, 졸업 전까지 개발자가 될줄은 몰랐기 때문에 저수준 강의는 자료구조 빼면 하나도 듣지 않았다 ㅎㅎㅎ... 그런데 작년에 단순 반복문 돌리는 코드에서 코드상의 논리적 오류가 없음에도 불구하고 기대했던 대로 동작하지 않는 일이 발생했다. 이 에피소드는 오래된 기억을 상기시키느라고 문제 진단과 해결방법이 정확치 않으므로 양해 바란다. 매번 났으면 테스트 과정에서 알 수 있었을텐데 몇천분의 일 정도의 확률도 나기 때문에 상용 환경에..