@@ -366,12 +366,13 @@ def parse_ixbrl_url(instance_url: str, cache: HttpCache) -> XbrlInstance:
366366 return parse_ixbrl (instance_path , cache , instance_url )
367367
368368
369- def parse_ixbrl (instance_path : str , cache : HttpCache , instance_url : str or None = None ) -> XbrlInstance :
369+ def parse_ixbrl (instance_path : str , cache : HttpCache , instance_url : str or None = None , encoding = None ) -> XbrlInstance :
370370 """
371371 Parses a inline XBRL (iXBRL) instance file.
372372 :param instance_path: path to the submission you want to parse
373373 :param cache: HttpCache instance
374374 :param instance_url: url to the instance file(on the internet)
375+ :param encoding: optionally specify a file encoding
375376 This function will check, if the instance file is already in the cache and load it from there based on the
376377 instance_url.
377378 For EDGAR submissions: Before calling this method; extract the enclosure and copy the files to the cache.
@@ -384,7 +385,7 @@ def parse_ixbrl(instance_path: str, cache: HttpCache, instance_url: str or None
384385 => in the XBRL-parse function root is ET.Element, here just an instance of ElementTree class!
385386 """
386387
387- instance_file = open (instance_path , "r" )
388+ instance_file = open (instance_path , "r" , encoding = encoding )
388389 contents = instance_file .read ()
389390 pattern = r'<[ ]*script.*?\/[ ]*script[ ]*>'
390391 contents = re .sub (pattern , '' , contents , flags = (re .IGNORECASE | re .MULTILINE | re .DOTALL ))
0 commit comments