Hey guys, can you help me?
I want to use Russian words for phrases to replace, it uses Regex and looks like it doesn't support Cyrillic? (doesn't react on russian words) how can i fix it?
Code:
/datum/dna/gene/disability/speech/chav
name = "Chav"
desc = "Forces the language center of the subject's brain to construct sentences in a more rudimentary manner."
activation_message = "Ye feel like a rite prat like, innit?"
deactivation_message = "You no longer feel like being rude and sassy."
mutation = CHAV
//List of swappable words. Normal word first, chav word second.
var/static/list/chavlinks = list(
"yikes" = "blimey",
"твой" = "твое"
)
/datum/dna/gene/disability/speech/chav/New()
..()
block = GLOB.chavblock
/datum/dna/gene/disability/speech/chav/OnSay(mob/M, message)
var/static/regex/R = regex("\\b([chavlinks.Join("|")])\\b", "g")
message = R.Replace(message, /datum/dna/gene/disability/speech/chav/proc/replace_speech)
return message
/datum/dna/gene/disability/speech/chav/proc/replace_speech(matched)
return chavlinks[matched]
I also tried this, but compiler throws me "unexpected character (ascii 143)", etc.
/datum/dna/gene/disability/speech/chav/OnSay(mob/M, message)
var/static/regex/R = regex("\\b([chavlinks.Join("|")])\\b[ЁёА-я]", "g")
message = R.Replace_char(message, /datum/dna/gene/disability/speech/chav/proc/replace_speech)
return message
/datum/dna/gene/disability/speech/chav/proc/replace_speech(matched)
return chavlinks[matched]
Sources:
https://github.com/ParadiseSS13/Paradise
(code\game\dna\genes\goon_disabilities.dm)
If the user's input has already been sent through html_encode(), then there shouldn't be an issue here.