Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -206,9 +206,10 @@ def generate_pdf(strategy):
|
|
| 206 |
pdf.add_page()
|
| 207 |
pdf.set_font("Arial", size=12)
|
| 208 |
|
| 209 |
-
# Add strategy content to PDF
|
| 210 |
for line in strategy.split('\n'):
|
| 211 |
-
|
|
|
|
| 212 |
|
| 213 |
pdf_output = "investment_strategy.pdf"
|
| 214 |
pdf.output(pdf_output)
|
|
|
|
| 206 |
pdf.add_page()
|
| 207 |
pdf.set_font("Arial", size=12)
|
| 208 |
|
| 209 |
+
# Add strategy content to PDF with UTF-8 encoding
|
| 210 |
for line in strategy.split('\n'):
|
| 211 |
+
# Encode the line to UTF-8 and decode it back to handle Unicode characters
|
| 212 |
+
pdf.cell(0, 10, txt=line.encode('utf-8').decode('latin-1', 'ignore'), ln=True)
|
| 213 |
|
| 214 |
pdf_output = "investment_strategy.pdf"
|
| 215 |
pdf.output(pdf_output)
|