May-01-2021, 04:32 PM
Hello,
I have a database with a number of fields and 1 of the fields is Rating. This field contains the word, One, Two, Three, Four or Five.
Each time I loop through a record, I want the Rating string to be converted to x number of stars based on the string passed to it.
I have written a function that does this. The function displays the correct # of stars if I am sending the output to my VSC Terminal. When I try convertting it to a pdf (using fpdf) I receive an error:
I have a database with a number of fields and 1 of the fields is Rating. This field contains the word, One, Two, Three, Four or Five.
Each time I loop through a record, I want the Rating string to be converted to x number of stars based on the string passed to it.
I have written a function that does this. The function displays the correct # of stars if I am sending the output to my VSC Terminal. When I try convertting it to a pdf (using fpdf) I receive an error:
# partial code in my fpdf function
tmp = star_rating(row[7])
pdf.cell(25, 0, tmp, align="L", border=0)
# partial code in star_rating()
star = "\u2B50"
if string == "Three":
times = 3
etc.
return star * timesUnicodeEncodeError: 'latin-1' codec can't encode characters in position 1275-1278: ordinal not in range(256)The font I am using is Arial.
