i have been trying to print arabic characters using SPRT thermal printer with the python-escpos package, but i cant seem to find any solution at all, so i decided to draw the arabic characters to a bitmap and then print it. But that also doesn't work..
this is the code used for converting the text to bitmap: `
from PIL import Image, ImageDraw, ImageFont
img = Image.new('L', (100, 10))
d = ImageDraw.Draw(img)
a = 'محمد'
d.text((1,1), f"{a}",255)
img.save('pil_text.png')
`
Result in Error:
UnicodeEncodeError: 'latin-1' codec can't encode characters in position 0-3: ordinal not in range(256)
Also, i have tried to encode the string using utf-8 and 1256, but both didnt give me the correct characters:
b'\xd9\x85\xd8\xad\xd9\x85\xd8\xaf'