fix: add support for multibyte chars for truncate, stripped_input, tgui_input_text (#85313)

## About The Pull Request

Add support for multibyte chars for `truncate`, `stripped_input`,
`tgui_input_text`.

Right now, on UI of `tgui_input_text` chars are counted, but on back-end
- bytes. So I made it consistent.
Also fixed that for `stripped_input`, which is used in case of disabled
`tgui input`.
While I was here, made `truncate` proc consistent too

## Why It's Good For The Game

Tgui text input won't lie about the size of input

## Changelog
N/A
This commit is contained in:
Gaxeer
2024-07-31 22:26:12 +02:00
committed by GitHub
parent 92730f914d
commit 7e7adf6583
2 changed files with 5 additions and 5 deletions
+2 -2
View File
@@ -140,9 +140,9 @@
switch(action)
if("submit")
if(max_length)
if(length(params["entry"]) > max_length)
if(length_char(params["entry"]) > max_length)
CRASH("[usr] typed a text string longer than the max length")
if(encode && (length(html_encode(params["entry"])) > max_length))
if(encode && (length_char(html_encode(params["entry"])) > max_length))
to_chat(usr, span_notice("Your message was clipped due to special character usage."))
set_entry(params["entry"])
closed = TRUE