ID:2775421
 
Resolved
replacetext() sometimes doubled up the first character in the replacement text when it was supposed to capitalize that character instead.
BYOND Version:514
Operating System:Windows 10 Home
Web Browser:Chrome 98.0.4758.109
Applies to:Dream Daemon
Status: Resolved (514.1582)

This issue has been resolved.
Descriptive Problem Summary:

When doing replacetext (or replacetext_char for that matter) on cyrillic texts, uppercase letters are replaced incorrectly.

Numbered Steps to Reproduce Problem:

Try replacing an uppercase cyrillic letter in text with string longer than 1

Code Snippet (if applicable) to Reproduce Problem:
world.log << "[replacetext("Robot working", "r", "hs")]"
world.log << "[replacetext("&#1056;&#1072;&#1073;&#1086;&#1090;&#1072; &#1088;&#1086;&#1073;&#1086;&#1090;&#1072;", "&#1088;", "&#1093;&#1089;")]"
world.log << "[replacetext_char("Robot working", "r", "hs")]"
world.log << "[replacetext_char("&#1056;&#1072;&#1073;&#1086;&#1090;&#1072; &#1088;&#1086;&#1073;&#1086;&#1090;&#1072;", "&#1088;", "&#1093;&#1089;")]"


(the cyrillic text whish is not shown for some reason is Работа робота, and I'm trying to replace р with хс)

Expected Results:
Hsobot wohsking
Хсабота хсобота

Actual Results:
Hsobot wohsking
ххсабота хсобота

Does the problem occur:
Every time? Or how often?
every time
In other games?
I don't know, tested on SS13 only

Did the problem NOT occur in any earlier versions? If so, what was the last version that worked? (Visit http://www.byond.com/download/build to download old versions for testing.)

I don't know, I haven't noticed

Workarounds:

doing replacetextEx on two seperate letters, one uppercase and one lowercase

Can you post this code in a zip for me so I can try it without the forum altering the snippet?
Couldn't figure out how to attach a zip file to post, so here's a link to pastebin with the code https://pastebin.com/CQ1eAJ5G
Lummox JR resolved issue with message:
replacetext() sometimes doubled up the first character in the replacement text when it was supposed to capitalize that character instead.
With 1583 this bug is back again.
Huh. I was sure I had retested this to be sure it still worked. I'll recheck. Maybe it was the wrong test project I looked at.

However I'll actually need a new bug report since this one has been closed already.

[edit]
I'm not seeing this on the original test case. So I'll need a new test case along with a new bug report if you can confirm there's a problem.