wxWidgets / Phoenix

wxPython's Project Phoenix. A new implementation of wxPython, better, stronger, faster than he was before.
http://wxpython.org/
2.22k stars 509 forks source link

StyledTextCtrl. SetText and emoji #2472

Closed Jenyay closed 6 months ago

Jenyay commented 7 months ago

Operating system: Windows 10 (everything is fine on Linux) wxPython version & source: 4.2.1 Python version & source: Python 3.8

Description of the problem: If there are some emoji (📌, 💡, 💾) in the text, inserting the text using SetText() will trim the last character.

import wx
import wx.stc

class TestFrame(wx.Frame):
    def __init__(self, parent, title):
        wx.Frame.__init__(self, parent, wx.ID_ANY, title, size=(400, 300))
        self.text = wx.stc.StyledTextCtrl(self)
        self.text.SetText("📌 111 222 333")

if __name__ == '__main__':
    app = wx.App()
    frame = TestFrame(None, 'StyledTextCtrl Test')
    frame.Show()
    app.MainLoop()

Result: StyledTextCtrl Test

reticulatus commented 7 months ago

It's probably related to the following issue: https://github.com/wxWidgets/Phoenix/issues/2446

swt2c commented 7 months ago

Yes, I think it's a duplicate of #2446.

Metallicow commented 4 months ago

Umm yeah I think you nailed the issue.

... but always remember all Llama emoji are at LEAST 2 chars long haha...