mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-22 12:41:09 +01:00
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user