Fixes сука блять (#7671)

* fix unicode stuff

* fucking hell this is what I get for copypasting from TG

* fucking hell this is what I get for forgetting to save before commiting
This commit is contained in:
monster860
2020-01-20 00:02:44 -05:00
committed by GitHub
parent 46408f4b68
commit 34444062fd
16 changed files with 43 additions and 22 deletions

View File

@@ -51,7 +51,6 @@ SUBSYSTEM_DEF(chat)
C.chatOutput.messageQueue += message
continue
message = to_utf8(message, I) // yogs - LibVG
payload[C] += url_encode(url_encode(message))
else
@@ -64,5 +63,4 @@ SUBSYSTEM_DEF(chat)
C.chatOutput.messageQueue += message
return
message = to_utf8(message, target) // yogs - LibVG
payload[C] += url_encode(url_encode(message))

View File

@@ -5,6 +5,7 @@
set hidden = 1
if(!check_rights(0))
return
msg = to_utf8(msg, src)
msg = emoji_parse(copytext(sanitize(msg), 1, MAX_MESSAGE_LEN))
if(!msg)
@@ -20,4 +21,5 @@
/client/proc/get_admin_say()
var/msg = input(src, null, "asay \"text\"") as text|null
msg = to_utf8(msg, src)
cmd_admin_say(msg)

View File

@@ -14,6 +14,7 @@
if (handle_spam_prevention(msg,MUTE_DEADCHAT))
return
msg = to_utf8(msg, src)
msg = copytext(sanitize(msg), 1, MAX_MESSAGE_LEN)
mob.log_talk(msg, LOG_DSAY)
@@ -38,5 +39,6 @@
// yogs start - Cancel button
var/msg = input(src, null, "dsay \"text\"") as text|null
if(msg)
msg = to_utf8(msg, src)
dsay(msg)
// yogs end

View File

@@ -34,6 +34,7 @@
if(!msg)
message_admins("[key_name_admin(src)] decided not to answer [ADMIN_LOOKUPFLW(M)]'s prayer")
return
msg = to_utf8(msg, src)
if(usr)
if (usr.client)
if(usr.client.holder)
@@ -74,6 +75,7 @@
if(!input)
message_admins("[key_name_admin(src)] decided not to answer [key_name_admin(H)]'s [sender] request.")
return
input = to_utf8(input, src)
log_directed_talk(mob, H, input, LOG_ADMIN, "reply")
message_admins("[key_name_admin(src)] replied to [key_name_admin(H)]'s [sender] message with: \"[input]\"")
@@ -138,6 +140,7 @@
if (!msg)
return
msg = to_utf8(msg, src)
to_chat(world, "[msg]")
log_admin("GlobalNarrate: [key_name(usr)] : [msg]")
message_admins("<span class='adminnotice'>[key_name_admin(usr)] Sent a global narrate</span>")
@@ -161,6 +164,8 @@
if( !msg )
return
msg = to_utf8(msg, src)
to_chat(M, msg)
log_admin("DirectNarrate: [key_name(usr)] to ([M.name]/[M.key]): [msg]")
msg = "<b> DirectNarrate: [key_name(usr)] to ([M.name]/[M.key]):</b> [msg]" // yogs - Yog Tickets
@@ -182,6 +187,7 @@
var/msg = input("Message:", text("Enter the text you wish to appear to everyone within view:")) as text|null
if (!msg)
return
msg = to_utf8(msg, src)
for(var/mob/M in view(range,A))
to_chat(M, msg)

View File

@@ -329,7 +329,7 @@
var/speak_text = input(src, "What would you like to say with your minions?", "Blob Broadcast", null) as text
if(!speak_text)
return
else
speak_text = to_utf8(speak_text, src)
to_chat(src, "You broadcast with your minions, <B>[speak_text]</B>")
for(var/BLO in blob_mobs)
var/mob/living/simple_animal/hostile/blob/BM = BLO

View File

@@ -335,6 +335,7 @@
switch(user.zone_selected)
if(BODY_ZONE_PRECISE_MOUTH)
var/wgw = sanitize(input(user, "What would you like the victim to say", "Voodoo", null) as text)
wgw = to_utf8(wgw, src)
target.say(wgw, forced = "voodoo doll")
log_game("[key_name(user)] made [key_name(target)] say [wgw] with a voodoo doll.")
if(BODY_ZONE_PRECISE_EYES)

View File

@@ -29,7 +29,7 @@ GLOBAL_VAR_INIT(mentor_ooc_colour, YOGS_MENTOR_OOC_COLOUR) // yogs - mentor ooc
if(QDELETED(src))
return
msg = utf8_sanitize(msg, src, MAX_MESSAGE_LEN) // yogs - libvg support yo
msg = copytext(sanitize(to_utf8(msg, src)), 1, MAX_MESSAGE_LEN)
var/raw_msg = msg
if(!msg)

View File

@@ -218,7 +218,6 @@ GLOBAL_DATUM_INIT(iconCache, /savefile, new("tmp/iconCache.sav")) //Cache of ico
// Do the double-encoding outside the loop to save nanoseconds
var/twiceEncoded = url_encode(url_encode(message))
for(var/I in target)
message = to_utf8(message, I) // yogs - LibVG
var/client/C = CLIENT_FROM_VAR(I) //Grab us a client if possible
if (!C)
continue
@@ -240,8 +239,6 @@ GLOBAL_DATUM_INIT(iconCache, /savefile, new("tmp/iconCache.sav")) //Cache of ico
if (!C)
return
message = to_utf8(message, target) // yogs - LibVG
//Send it to the old style output window.
SEND_TEXT(C, original_message)

View File

@@ -98,7 +98,7 @@ Doesn't work on other aliens/AI.*/
if(M.anti_magic_check(FALSE, FALSE, TRUE, 0))
to_chat(user, "<span class='noticealien'>As you try to communicate with [M], you're suddenly stopped by a vision of a massive tinfoil wall that streches beyond visible range. It seems you've been foiled.</span>")
return FALSE
var/msg = sanitize(input("Message:", "Alien Whisper") as text|null)
var/msg = sanitize(to_utf8(input("Message:", "Alien Whisper") as text|null, usr))
if(msg)
if(M.anti_magic_check(FALSE, FALSE, TRUE, 0))
to_chat(user, "<span class='notice'>As you try to communicate with [M], you're suddenly stopped by a vision of a massive tinfoil wall that streches beyond visible range. It seems you've been foiled.</span>")

View File

@@ -635,7 +635,7 @@
Remove(H)
return
var/message = sanitize(input("Message:", "Slime Telepathy") as text|null)
var/message = sanitize(to_utf8(input("Message:", "Slime Telepathy") as text|null))
if(!species || !(H in species.linked_mobs))
to_chat(H, "<span class='warning'>The link seems to have been severed...</span>")
@@ -685,7 +685,7 @@
if(M.anti_magic_check(FALSE, FALSE, TRUE, 0))
to_chat(H, "<span class='notice'>As you try to communicate with [M], you're suddenly stopped by a vision of a massive tinfoil wall that streches beyond visible range. It seems you've been foiled.</span>")
return
var/msg = sanitize(input("Message:", "Telepathy") as text|null)
var/msg = sanitize(to_utf8(input("Message:", "Telepathy") as text|null))
if(msg)
if(M.anti_magic_check(FALSE, FALSE, TRUE, 0))
to_chat(H, "<span class='notice'>As you try to communicate with [M], you're suddenly stopped by a vision of a massive tinfoil wall that streches beyond visible range. It seems you've been foiled.</span>")

View File

@@ -435,7 +435,7 @@
to_chat(user, "You cannot send IC messages (muted).")
return FALSE
else if(!params)
var/custom_emote = copytext(sanitize(input("Choose an emote to display.") as text|null), 1, MAX_MESSAGE_LEN)
var/custom_emote = copytext(sanitize(to_utf8(input("Choose an emote to display.") as text|null)), 1, MAX_MESSAGE_LEN)
if(custom_emote && !check_invalid(user, custom_emote))
var/type = input("Is this a visible or hearable emote?") as null|anything in list("Visible", "Hearable")
switch(type)

View File

@@ -10,7 +10,7 @@
message_admins("[key_name(usr)] just tripped a pretty filter: '[oldmsg]'.")
return
if(isliving(src))
message = minor_filter(message) //yogs end - pretty filter
message = minor_filter(to_utf8(message)) //yogs end - pretty filter
if(GLOB.say_disabled) //This is here to try to identify lag problems
to_chat(usr, "<span class='danger'>Speech is currently admin-disabled.</span>")
@@ -29,7 +29,7 @@
to_chat(usr, "<span class='notice'>You fumble over your words. <a href='https://forums.yogstation.net/index.php?pages/rules/'>See rule 0.1.1</a>.</span>")
message_admins("[key_name(usr)] just tripped a pretty filter: '[oldmsg]'.")
return
message = minor_filter(message) //yogs end - pretty filter
message = to_utf8(minor_filter(message)) //yogs end - pretty filter
if(GLOB.say_disabled) //This is here to try to identify lag problems
to_chat(usr, "<span class='danger'>Speech is currently admin-disabled.</span>")
@@ -47,7 +47,7 @@
to_chat(usr, "<span class='danger'>Speech is currently admin-disabled.</span>")
return
message = utf8_sanitize(message, usr, MAX_MESSAGE_LEN) // yogs - libvg support
message = copytext(sanitize(to_utf8(message)), 1, MAX_MESSAGE_LEN) // yogs - libvg support
usr.emote("me",1,message,TRUE)

View File

@@ -12,6 +12,7 @@
webhook_send_asay(key_name(src), msg)
msg = sanitize(msg)
msg = to_utf8(msg)
mob.log_talk(msg, LOG_ADMIN_PRIVATE)
@@ -28,4 +29,5 @@
/client/proc/get_admin_say()
var/msg = input(src, null, "asay \"text\"") as text|null
msg = to_utf8(msg)
cmd_admin_say(msg)

View File

@@ -29,7 +29,7 @@
to_chat(src, "<span class='danger'>You have been banned from LOOC.</span>")
return
msg = copytext(sanitize(msg), 1, MAX_MESSAGE_LEN)
msg = copytext(sanitize(to_utf8(msg)), 1, MAX_MESSAGE_LEN)
var/raw_msg = msg
if(!msg)

View File

@@ -17,9 +17,22 @@
if (M.client)
. = M.client.encoding
/proc/to_utf8(var/message, var/mob_or_client)
return LIBVG("to_utf8", _determine_encoding(mob_or_client), message)
#if DM_VERSION < 513
/proc/to_utf8(var/message, var/mob_or_client = usr)
. = message // in case runtimes happen
var/is_513 = FALSE
if(istype(mob_or_client, /client))
var/client/C = mob_or_client
is_513 = (C.byond_version >= 513)
else if(ismob(mob_or_client))
var/mob/M = mob_or_client
if(M.client)
is_513 = (M.client.byond_version >= 513)
return is_513 ? message : LIBVG("to_utf8", _determine_encoding(mob_or_client), message)
#else
/proc/to_utf8(var/message) // it's already utf8
return message
#endif
// Converts a byte string to a UTF-8 string, sanitizes it and caps the length.
/proc/utf8_sanitize(var/message, var/mob_or_client, var/length = MAX_MESSAGE_LEN)