adafruit / adafruit/Adafruit_CircuitPython_framebuf
Test for Usable Characters
- Dominant language
- Python
- Stars
- 42
- Forks
- 36
- PR merge metrics
- No merged PRs in 30d
Description
Adafruit_framebuf.py on Line 567 line = struct.unpack("B", self._font.read(1))[0] randomly causing
struct.error: ('unpack requires a buffer of 1 byte')
from my code
LineBuf =(x.text.strip()[0:60])
pixel_framebuf.text(LineBuf, i, 4, 0x0000FF)
It appears the web text randomly contained Unicode Decimal 8217 RIGHT SINGLE QUOTATION MARK which I'm guessing is not part of font5x8.bin and thus generates the error? When I replace with Unicode Decimal 39 APOSTROPHE all is good.
Of course they look pretty identical so it was difficult to understand the problem.
Is it possible to include a check for Usable Characters ?
Contributor guide
No contributing guide indexed for this repository
Research direction
Start at Adafruit_framebuf.py line 567 and reproduce the failure with the supplied LineBuf example containing Unicode U+2019, then compare it with the ASCII apostrophe case. Determine the expected handling for characters not represented by font5x8.bin; done should include coverage showing that such input no longer raises the reported struct.error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- embedded-iot
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100