Path: blob/master/thirdparty/chardet/cp949prober.py
2992 views
######################## BEGIN LICENSE BLOCK ########################1# The Original Code is mozilla.org code.2#3# The Initial Developer of the Original Code is4# Netscape Communications Corporation.5# Portions created by the Initial Developer are Copyright (C) 19986# the Initial Developer. All Rights Reserved.7#8# Contributor(s):9# Mark Pilgrim - port to Python10#11# This library is free software; you can redistribute it and/or12# modify it under the terms of the GNU Lesser General Public13# License as published by the Free Software Foundation; either14# version 2.1 of the License, or (at your option) any later version.15#16# This library is distributed in the hope that it will be useful,17# but WITHOUT ANY WARRANTY; without even the implied warranty of18# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU19# Lesser General Public License for more details.20#21# You should have received a copy of the GNU Lesser General Public22# License along with this library; if not, write to the Free Software23# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA24# 02110-1301 USA25######################### END LICENSE BLOCK #########################2627from .chardistribution import EUCKRDistributionAnalysis28from .codingstatemachine import CodingStateMachine29from .mbcharsetprober import MultiByteCharSetProber30from .mbcssm import CP949_SM_MODEL313233class CP949Prober(MultiByteCharSetProber):34def __init__(self):35super(CP949Prober, self).__init__()36self.coding_sm = CodingStateMachine(CP949_SM_MODEL)37# NOTE: CP949 is a superset of EUC-KR, so the distribution should be38# not different.39self.distribution_analyzer = EUCKRDistributionAnalysis()40self.reset()4142@property43def charset_name(self):44return "CP949"4546@property47def language(self):48return "Korean"495051