@@ -366,12 +366,13 @@ def parse_ixbrl_url(instance_url: str, cache: HttpCache) -> XbrlInstance:
366
366
return parse_ixbrl (instance_path , cache , instance_url )
367
367
368
368
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 :
370
370
"""
371
371
Parses a inline XBRL (iXBRL) instance file.
372
372
:param instance_path: path to the submission you want to parse
373
373
:param cache: HttpCache instance
374
374
:param instance_url: url to the instance file(on the internet)
375
+ :param encoding: optionally specify a file encoding
375
376
This function will check, if the instance file is already in the cache and load it from there based on the
376
377
instance_url.
377
378
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
384
385
=> in the XBRL-parse function root is ET.Element, here just an instance of ElementTree class!
385
386
"""
386
387
387
- instance_file = open (instance_path , "r" )
388
+ instance_file = open (instance_path , "r" , encoding = encoding )
388
389
contents = instance_file .read ()
389
390
pattern = r'<[ ]*script.*?\/[ ]*script[ ]*>'
390
391
contents = re .sub (pattern , '' , contents , flags = (re .IGNORECASE | re .MULTILINE | re .DOTALL ))
0 commit comments