rawpython / remi

Python REMote Interface library. Platform independent. In about 100 Kbytes, perfect for your diet.
Apache License 2.0
3.48k stars 401 forks source link

TextInput event hangs on non-basic ASCII characters #457

Closed caco3 closed 2 years ago

caco3 commented 2 years ago

I have a simple application with a TextInput field. Whenever a key gets pressed, I want to get an event. This works fine until I enter a non-basic ASCII character (ASCII code > 127), eg. a character like ä (Code 132 on https://theasciicode.com.ar/extended-ascii-code/letter-a-umlaut-diaeresis-a-umlaut-lowercase-ascii-code-132.html)

Example application to reproduce it:

import remi.gui as gui
from remi import start, App

class MyApp(App):
    def __init__(self, *args):
        super(MyApp, self).__init__(*args)

    def main(self):
        container = gui.Container(width=600, height=300)

        self.comment = gui.TextInput(width=500, height=20)
        self.comment.onkeyup.do(self.onCommentKeyUp)

        container.append([self.comment])

        return container

    def onCommentKeyUp(self, widget, new_value, keycode):
        print("%s, %s" % (new_value, keycode))

start(MyApp)

When I eg. enter the following characters one after the other, I get the following events: a => a, 65 b => ab, 66 c => abc, 67 d => abcd, 68 ä => abcdä|, => No keycode provided d => no more events

dddomodossola commented 2 years ago

@caco3 thank you a lot for reporting, I will fix it as soon as possible. Can you please report also your browser, python version, system?

caco3 commented 2 years ago

I am running Ubuntu 20.10, 64bit with Python 3.8.10 Browser: Firefox 90, 64bit

I also tested web access from Windows 10, Chrome 92 (While still running remi on my Linux Machine).

Let me know if you can also reproduce it on your side. Else I will also try to test it on other systems.

dddomodossola commented 2 years ago

@caco3 I pushed a bugfix on master branch, can you please test it? It seems that an old fix about string encoding is no more required, sice javascript side and python server uses the same encoding.

caco3 commented 2 years ago

@dddomodossola Thank you very much! Indeed this fixes the issue!