(self)
Parse RTF code page
Parse RTF code page
Parse RTF code page
def parse_code_page(self):
        """Parse RTF code page"""
        self.features['ansi_code_page'] = 0
        self.features['ansi_code_page_name'] = u'unknown'
        page = re.compile(r'.*\\ansicpg(\d+)', re.M | re.S)
        match = page.match(self.data)
        if match:
            try:
                value = int(match.group(1))
                self.features['ansi_code_page'] = value
                self.features['ansi_code_page_name'] = \
                    self.code_page_map.get(value, 'unknown')
            except Exception:
                if self.debug:
                    print('Could not convert ansi code page to int')
def parse_code_page ( self ) : self . features [ 'ansi_code_page' ] = 0 self . features [ 'ansi_code_page_name' ] = u'unknown' page = re . compile ( r'.*\\ansicpg(\d+)' , re . M | re . S ) match = page . match ( self . data ) if match : try : value = int ( match . group ( 1 ) ) self . features [ 'ansi_code_page' ] = value self . features [ 'ansi_code_page_name' ] = self . code_page_map . get ( value , 'unknown' ) except Exception : if self . debug : print ( 'Could not convert ansi code page to int' )