-- ============================================
-- 이중 인코딩(UTF-8→latin1→UTF-8) 한글 데이터 수정
-- 2026-03-25 적용 완료
-- ============================================

-- local_government
UPDATE `local_government` SET `lg_name` = CONVERT(BINARY(CONVERT(`lg_name` USING latin1)) USING utf8mb4) WHERE `lg_name` IS NOT NULL AND `lg_name` != '';
UPDATE `local_government` SET `lg_sido` = CONVERT(BINARY(CONVERT(`lg_sido` USING latin1)) USING utf8mb4) WHERE `lg_sido` IS NOT NULL AND `lg_sido` != '';
UPDATE `local_government` SET `lg_gugun` = CONVERT(BINARY(CONVERT(`lg_gugun` USING latin1)) USING utf8mb4) WHERE `lg_gugun` IS NOT NULL AND `lg_gugun` != '';
UPDATE `local_government` SET `lg_addr` = CONVERT(BINARY(CONVERT(`lg_addr` USING latin1)) USING utf8mb4) WHERE `lg_addr` IS NOT NULL AND `lg_addr` != '';

-- code_kind
UPDATE `code_kind` SET `ck_name` = CONVERT(BINARY(CONVERT(`ck_name` USING latin1)) USING utf8mb4) WHERE `ck_name` IS NOT NULL AND `ck_name` != '';

-- code_detail
UPDATE `code_detail` SET `cd_name` = CONVERT(BINARY(CONVERT(`cd_name` USING latin1)) USING utf8mb4) WHERE `cd_name` IS NOT NULL AND `cd_name` != '';
