import re
with open("app/modules/invoices/application/invoice_processing/misa_exporter.py", "r", encoding="utf-8") as f:
    content = f.read()

content = content.replace('{inv.get("buyer_tax_code") or "Chua cung c?p"}', '{html.escape(str(inv.get("buyer_tax_code") or "Chua cung c?p"))}')
content = content.replace('{inv.get("buyer_address") or "Theo h?p d?ng thi cng"}', '{html.escape(str(inv.get("buyer_address") or "Theo h?p d?ng thi cng"))}')
content = content.replace('{inv.get("xml_hash_sha256", "")[:16]}', '{html.escape(str(inv.get("xml_hash_sha256", ""))[:16])}')

with open("app/modules/invoices/application/invoice_processing/misa_exporter.py", "w", encoding="utf-8") as f:
    f.write(content)
