mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-23 23:19:20 +00:00
log encoding exception
This commit is contained in:
committed by
Rohit Waghchaure
parent
9e0762e8c2
commit
eb87566fa6
@@ -40,10 +40,15 @@ class ImportSupplierInvoice(Document):
|
|||||||
taxes = []
|
taxes = []
|
||||||
terms = []
|
terms = []
|
||||||
encoded_content = zf.read(file_name)
|
encoded_content = zf.read(file_name)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
content = encoded_content.decode("utf-8-sig")
|
content = encoded_content.decode("utf-8-sig")
|
||||||
except UnicodeDecodeError:
|
except UnicodeDecodeError:
|
||||||
content = encoded_content.decode("utf-16")
|
try:
|
||||||
|
content = encoded_content.decode("utf-16")
|
||||||
|
except UnicodeDecodeError as e:
|
||||||
|
frappe.log_error(message=e, title="UTF-16 encoding error for File Name: " + file_name)
|
||||||
|
|
||||||
file_content = bs(content, "xml")
|
file_content = bs(content, "xml")
|
||||||
|
|
||||||
for line in file_content.find_all("DatiTrasmissione"):
|
for line in file_content.find_all("DatiTrasmissione"):
|
||||||
|
|||||||
Reference in New Issue
Block a user