mbcsgroupprober.py 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. ######################## BEGIN LICENSE BLOCK ########################
  2. # The Original Code is Mozilla Universal charset detector code.
  3. #
  4. # The Initial Developer of the Original Code is
  5. # Netscape Communications Corporation.
  6. # Portions created by the Initial Developer are Copyright (C) 2001
  7. # the Initial Developer. All Rights Reserved.
  8. #
  9. # Contributor(s):
  10. # Mark Pilgrim - port to Python
  11. # Shy Shalom - original C code
  12. # Proofpoint, Inc.
  13. #
  14. # This library is free software; you can redistribute it and/or
  15. # modify it under the terms of the GNU Lesser General Public
  16. # License as published by the Free Software Foundation; either
  17. # version 2.1 of the License, or (at your option) any later version.
  18. #
  19. # This library is distributed in the hope that it will be useful,
  20. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  21. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  22. # Lesser General Public License for more details.
  23. #
  24. # You should have received a copy of the GNU Lesser General Public
  25. # License along with this library; if not, write to the Free Software
  26. # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
  27. # 02110-1301 USA
  28. ######################### END LICENSE BLOCK #########################
  29. from .charsetgroupprober import CharSetGroupProber
  30. from .utf8prober import UTF8Prober
  31. from .sjisprober import SJISProber
  32. from .eucjpprober import EUCJPProber
  33. from .gb2312prober import GB2312Prober
  34. from .euckrprober import EUCKRProber
  35. from .cp949prober import CP949Prober
  36. from .big5prober import Big5Prober
  37. from .euctwprober import EUCTWProber
  38. class MBCSGroupProber(CharSetGroupProber):
  39. def __init__(self, lang_filter=None):
  40. super(MBCSGroupProber, self).__init__(lang_filter=lang_filter)
  41. self.probers = [
  42. UTF8Prober(),
  43. SJISProber(),
  44. EUCJPProber(),
  45. GB2312Prober(),
  46. EUCKRProber(),
  47. CP949Prober(),
  48. Big5Prober(),
  49. EUCTWProber()
  50. ]
  51. self.reset()