Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Oct 28, 2025

The badge bitmap fonts only support ASCII/Latin-1 (code points ≤255), causing CJK characters to render as placeholder boxes.

Changes

  • Added has_unsupported_chars() to detect characters outside the Latin-1 range
  • Modified name display to fall back to GitHub handle when unsupported characters detected
  • GitHub handles are ASCII-only by platform requirement, guaranteeing renderable text

Implementation

def has_unsupported_chars(text):
    """Check if text contains characters outside the ASCII/Latin-1 range (>255)"""
    if not text:
        return False
    try:
        return any(ord(char) > 255 for char in text)
    except (TypeError, AttributeError):
        return True

# In User.draw():
name = placeholder_if_none(self.name)
if self.name and has_unsupported_chars(self.name):
    name = self.handle if self.handle else name

Behavior

Display Name Before After
Thor E-弓 SCHAEFF Thor E-□ SCHAEFF thorwebdev
José García José García José García
张伟 □□ zhangwei

Latin-1 accented characters (é, ñ, ö) continue to display correctly.

Original prompt

This section details on the original issue you should resolve

<issue_title>Font for the name does not support chinese characters</issue_title>
<issue_description>The badges app does not support chinese characters in the name. See photo

Image</issue_description>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI changed the title [WIP] Fix font for name to support Chinese characters Fallback to GitHub handle for names with CJK characters Oct 28, 2025
Copilot finished work on behalf of gwincr11 October 28, 2025 23:15
Copilot AI requested a review from gwincr11 October 28, 2025 23:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Font for the name does not support chinese characters

2 participants