mirror of https://gitlab.com/bashrc2/epicyon
Convert hex to char
parent
075489bea4
commit
2b6aa3f44b
|
@ -65,7 +65,7 @@ def replaceEmojiFromTags(content: str,tag: [],messageType: str) -> str:
|
||||||
if iconName.startswith('1'):
|
if iconName.startswith('1'):
|
||||||
if '.' in iconName:
|
if '.' in iconName:
|
||||||
iconName=iconName.split('.')[0]
|
iconName=iconName.split('.')[0]
|
||||||
content=content.replace(tagItem['name'],'\\u'+iconName)
|
content=content.replace(tagItem['name'],chr(int("0x"+iconName,16)))
|
||||||
htmlClass='emoji'
|
htmlClass='emoji'
|
||||||
if messageType=='post header':
|
if messageType=='post header':
|
||||||
htmlClass='emojiheader'
|
htmlClass='emojiheader'
|
||||||
|
|
3
tests.py
3
tests.py
|
@ -1391,7 +1391,8 @@ def testAddEmoji():
|
||||||
tags.append(tag)
|
tags.append(tag)
|
||||||
content=contentModified
|
content=contentModified
|
||||||
contentModified=replaceEmojiFromTags(content,tags,'content')
|
contentModified=replaceEmojiFromTags(content,tags,'content')
|
||||||
assert contentModified=='<p>Emoji \\u1F34B \\u1F353 \\u1F34C</p>'
|
#print('contentModified: '+contentModified)
|
||||||
|
assert contentModified=='<p>Emoji 🍋 🍓 🍌</p>'
|
||||||
|
|
||||||
os.chdir(baseDirOriginal)
|
os.chdir(baseDirOriginal)
|
||||||
shutil.rmtree(baseDirOriginal+'/.tests')
|
shutil.rmtree(baseDirOriginal+'/.tests')
|
||||||
|
|
Loading…
Reference in New Issue