diff --git a/zerver/lib/markdown/__init__.py b/zerver/lib/markdown/__init__.py index 130134246b..611cb2b157 100644 --- a/zerver/lib/markdown/__init__.py +++ b/zerver/lib/markdown/__init__.py @@ -1475,11 +1475,8 @@ def make_realm_emoji(src: str, display_string: str) -> Element: def unicode_emoji_to_codepoint(unicode_emoji: str) -> str: codepoint = hex(ord(unicode_emoji))[2:] - # Unicode codepoints are minimum of length 4, padded - # with zeroes if the length is less than four. - while len(codepoint) < 4: - codepoint = "0" + codepoint - return codepoint + # Unicode codepoints are minimum of length 4, padded with zeroes + return codepoint.rjust(4, "0") class EmoticonTranslation(markdown.inlinepatterns.Pattern):