BUG: st.chat_input shows awkward behavior with korean input


st.chat_input shows awkward behavior with korean input, especially when the last character of input is korean.

Steps to reproduce

Code snippet:

import streamlit as st

prompt = st.chat_input("Say something")
if prompt:
    st.write(f"User has sent the following prompt: {prompt}")

Input the Korean in the chat input box. (e.g., μ•ˆλ…•ν•˜μ„Έμš”)

You can use here to reproduce the bug.

Expected behavior:

The following should be printed on the page.

User has sent the following prompt: μ•ˆλ…•ν•˜μ„Έμš”

Actual behavior:

Only the last character is displayed on the page.
It means that only the last character is returned from the st.chat_input function when I input the Korean.

User has sent the following prompt: μš”

I found that this error occurs only when the last character of input is Korean.

β€œμ•ˆλ…•ν•˜μ„Έμš”β€ β†’ wrong behavior
β€œμ•ˆλ…•ν•˜μ„Έμš”.” β†’ right behavior
β€œμ•ˆλ…•ν•˜μ„Έμš” hello” β†’ right behavior

Debug info

  • Streamlit version: 1.24.0
  • Python version: 3.11.4
  • Using Pyenv
  • OS version: Linux
  • Browser version: Chrome

Works es expected for me using your link.

Step 1

Step 2

Thank you for the quick reply!
I also test it in a variety of browsers and find it works well…
Maybe this bug only occurs in Chrome with MacOS (or maybe the certain version of Chrome I use has an unknown problem)

Chrome version: 114.0.5735.133 (arm64)

I also have the same issue as above.
It seems to work fine in Safari, but not in Chrome or Edge.

When I type in β€˜μ•ˆλ…•ν•˜μ„Έμš”β€™, only β€˜μš”β€™ is output.
(Only the last single character at the end is output.)

Even if the sentence is written in English, only one Korean character is output the moment a Korean character is inserted at the end.

β€œThis is an English sentence. μš”β€
β†’ This will only output β€œμš”β€.

If the sentence ends in Korean, there is a problem, and if the sentence ends in English, numbers, or special characters, there is no problem.

Works as expected for me using Edge 112.0.1722.58. Cannot try Chrome.