Devavrat28 commited on
Commit
9df357c
·
verified ·
1 Parent(s): cd9103f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -2
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
- pdf.cell(0, 10, txt=line, ln=True)
 
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)