Improvement of Encoding Detection Algorithm for Multi-byte Encoded Data with Errors

오류가 발생한 멀티바이트 인코딩 데이터의 인코딩 기법 판별 알고리즘 개선

  • 배준우 (한양대학교 컴퓨터공학과) ;
  • 김선범 (한양대학교 컴퓨터공학과) ;
  • 박희진 (한양대학교 컴퓨터공학과)
  • Received : 2016.11.02
  • Accepted : 2017.04.21
  • Published : 2017.04.30

Abstract

In computer science, an encoding is a standardization of converting information to one format for audio, video or text. Therefore, the encoding information of the data should be known to open and read it and there are algorithms detecting encoder of the data. However, some informations of data could be disappeared by packet loss when transmitted on network, especially, if the data is snatched by packet sniffing or eavesdropping from wireless communications. In this paper, we improve the performance of encoding detection algorithm of 'uchardet' program for multi-byte encoded data with errors based on bit-shift algorithm. To simulate the performance, we generated Korean and Japanese text data with errors that is removed some random bits at random positions. Then the detection algorithm are tested using the data and 'uchardet-bitshift' showed better performance than 'uchardet'. When Korean texts are used, 'uchardet' could detect perfectly with ≤0.005% errors but it showed 0% detection rate with ≥1% errors while 'uchardet-bitshift' detected perfectly with ≤0.05% errors and it showed correct detection cases with ≥1% errors. Japanese texts with errors tend to report falsely as Chinese encoding because Japanese texts include lots of Chinese characters. As a results, we improved encoding detection algorithms by applying bit shift operation.

인코딩(encoding)은 컴퓨터에서 사용되는 음성, 영상 및 텍스트 문자를 부호화하는 방법을 가리킨다. 그러므로 특정 데이터를 열람하기 위해서는 해당 인코딩 정보를 알아야하며, 데이터마다 인코딩을 판별해주는 알고리즘들이 존재한다. 하지만 실제 음원이나 문서를 송수신하는 과정에서 패킷 손실이 발생할 수 있으며, 특히 무선 통신망에서 패킷 스니핑으로 정보를 가로챌 경우 손실률은 더욱 증가되어 인코딩 기법 판별에 어려움이 발생한다. 본 논문에서는 이러한 오류가 발생한 데이터의 인코딩 기법 판별율을 향상시키기 위해 기존의 문자 인코딩 기법 판별 프로그램인 'uchardet'에 Bit-shift 알고리즘을 적용하여 성능 향상을 이루었다. 알고리즘의 성능 평가를 위해 임의의 한글 및 일본어 텍스트 파일에 손실률(loss rate)을 적용하여 부분적으로 데이터가 소실된 인코딩 파일을 생성하여 결과를 비교하였다. 그 결과, 패킷이 손실된 데이터에서 Bit-shift 알고리즘을 적용한 'uchardet-bitshift' 경우 기존의 알고리즘보다 더 나은 성능을 보였다. 한국어 인코딩의 경우 기존의 uchardet는 0.005% 손실률까지 100%의 정확도를 보이고 1%보다 높은 손실률에서는 인코딩을 전혀 판별해 내지 못한데 비해, Bit-shift 알고리즘을 적용할 경우 0.05%의 손실률에도 100%의 정확도를 보였으며 그보다 큰 손실률에서도 해당 인코딩을 판별해냈다. 또한 한자어를 많이 포함하는 일본어의 경우 손실률이 높아질수록 중국어 인코딩으로 잘못 판별하는 경향을 보였다. 시뮬레이션 분석 결과, Bit shift 알고리즘을 추가하여 기존 인코딩 기법 판별 알고리즘의 개선이 가능하였다.

Keywords