diff --git a/bindings/python/example_scripts/Invoice.tex.tmpl b/bindings/python/example_scripts/Invoice.tex.tmpl index a5248cca9f..a16b03743a 100644 --- a/bindings/python/example_scripts/Invoice.tex.tmpl +++ b/bindings/python/example_scripts/Invoice.tex.tmpl @@ -130,13 +130,13 @@ \Euro %--------------------------------------------------------------------------- \begin{letter}{% {% endraw %} -{{ invoice.GetOwner().GetName().decode("UTF-8") }} \\ -{{ invoice.GetOwner().GetAddr().GetAddr1().decode("UTF-8") }} \\ -{{ invoice.GetOwner().GetAddr().GetAddr2().decode("UTF-8") }} \\ -{{ invoice.GetOwner().GetAddr().GetAddr3().decode("UTF-8") }} +{{ invoice.GetOwner().GetName() }} \\ +{{ invoice.GetOwner().GetAddr().GetAddr1() }} \\ +{{ invoice.GetOwner().GetAddr().GetAddr2() }} \\ +{{ invoice.GetOwner().GetAddr().GetAddr3() }} {# if Addr4 is declared put a linebreak here #} {% if invoice.GetOwner().GetAddr().GetAddr4() %} \\ {% endif %} -{{ invoice.GetOwner().GetAddr().GetAddr4().decode("UTF-8") }} {% raw %} +{{ invoice.GetOwner().GetAddr().GetAddr4() }} {% raw %} } %--------------------------------------------------------------------------- % Weitere Optionen @@ -156,7 +156,7 @@ Ich erlaube mir, Ihnen folgende Beträge in Rechnung zu stellen: {%- for ent in invoice.GetEntries() -%} {{- '\Artikel' -}} {{- '{' -}} {{- ent.GetQuantity() -}} {{- '}' -}} - {{- '{' -}} {{- ent.GetDescription().decode("UTF-8") -}} {{- '}' -}} + {{- '{' -}} {{- ent.GetDescription() -}} {{- '}' -}} {{- '{' -}} {{- ent.GetInvPrice().to_double() -}} {{- '}' -}} {%- endfor -%} {#- **************** JINJA2 Entries END ********************** -#} diff --git a/bindings/python/example_scripts/Invoice_2.tex.tmpl b/bindings/python/example_scripts/Invoice_2.tex.tmpl index 0c94fc7e17..ea2e7e33ef 100644 --- a/bindings/python/example_scripts/Invoice_2.tex.tmpl +++ b/bindings/python/example_scripts/Invoice_2.tex.tmpl @@ -134,13 +134,13 @@ \Euro %--------------------------------------------------------------------------- \begin{letter}{ {%- endraw -%} -{{- invoice.GetOwner().GetName().decode("UTF-8") -}} \\ -{{- invoice.GetOwner().GetAddr().GetAddr1().decode("UTF-8") -}} \\ -{{- invoice.GetOwner().GetAddr().GetAddr2().decode("UTF-8") -}} \\ -{{- invoice.GetOwner().GetAddr().GetAddr3().decode("UTF-8") -}} +{{- invoice.GetOwner().GetName() -}} \\ +{{- invoice.GetOwner().GetAddr().GetAddr1() -}} \\ +{{- invoice.GetOwner().GetAddr().GetAddr2() -}} \\ +{{- invoice.GetOwner().GetAddr().GetAddr3() -}} {# if Addr4 is declared put a linebreak here #} {%- if invoice.GetOwner().GetAddr().GetAddr4() -%} \\ {%- endif -%} -{{- invoice.GetOwner().GetAddr().GetAddr4().decode("UTF-8") -}} {%- raw -%} +{{- invoice.GetOwner().GetAddr().GetAddr4() -}} {%- raw -%} } %--------------------------------------------------------------------------- % Weitere Optionen @@ -167,7 +167,7 @@ Ich erlaube mir, Ihnen folgende Beträge in Rechnung zu stellen: {%- for ent in invoice.GetEntries() %} {{ loop.index }} & {{- locale.format("%.2f", ent.GetQuantity().to_double()) -}} & - {{- ent.GetDescription().decode("UTF-8") -}} & + {{- ent.GetDescription() -}} & \EUR{ {{- locale.format("%.2f", ent.GetInvPrice().to_double()) -}} } & \EUR{ {{- locale.format("%.2f", ent.GetInvPrice().to_double() * ent.GetQuantity().to_double()) -}} } \\ \hline {%- endfor -%} diff --git a/bindings/python/example_scripts/latex_invoices.py b/bindings/python/example_scripts/latex_invoices.py index 829021adfc..f494fb1318 100644 --- a/bindings/python/example_scripts/latex_invoices.py +++ b/bindings/python/example_scripts/latex_invoices.py @@ -115,19 +115,19 @@ def invoice_to_lco(invoice): add_str = u"" owner = invoice.GetOwner() if owner.GetName() != "": - add_str += owner.GetName().decode("UTF-8") + "\n" + add_str += owner.GetName() + "\n" addr = owner.GetAddr() if addr.GetName() != "": - add_str += addr.GetName().decode("UTF-8") + "\n" + add_str += addr.GetName() + "\n" if addr.GetAddr1() != "": - add_str += addr.GetAddr1().decode("UTF-8") + "\n" + add_str += addr.GetAddr1() + "\n" if addr.GetAddr2() != "": - add_str += addr.GetAddr2().decode("UTF-8") + "\n" + add_str += addr.GetAddr2() + "\n" if addr.GetAddr3() != "": - add_str += addr.GetAddr3().decode("UTF-8") + "\n" + add_str += addr.GetAddr3() + "\n" if addr.GetAddr4() != "": - add_str += addr.GetAddr4().decode("UTF-8") + "\n" + add_str += addr.GetAddr4() + "\n" lco_out += write_variable("toaddress2", add_str) @@ -147,7 +147,7 @@ def invoice_to_lco(invoice): # Write the entries ent_str = u"" - locale.setlocale(locale.LC_ALL, "de_DE") + locale.setlocale(locale.LC_ALL, "") for n, ent in enumerate(invoice.GetEntries()): line_str = u"" @@ -160,14 +160,14 @@ def invoice_to_lco(invoice): n = ent.GetQuantity() uprice = locale.currency(price).rstrip(" EUR") - un = unicode( + un = str( int(float(n.num()) / n.denom()) ) # choose best way to format numbers according to locale line_str = u"\Artikel{" line_str += un line_str += u"}{" - line_str += descr.decode("UTF-8") + line_str += descr line_str += u"}{" line_str += uprice line_str += u"}" @@ -288,7 +288,6 @@ def main(argv=None): # Opening output file f = open(output_file_name, "w") - lco_str = lco_str.encode("latin1") f.write(lco_str) f.close()