ID:2399401
 
BYOND Version:512.1448
Operating System:Windows 10 Home 64-bit
Web Browser:Chrome 68.0.3440.106
Applies to:DM Language
Status: Open

Issue hasn't been assigned a status value.
Descriptive Problem Summary:

Space Station 13: Paradise Station Codebase

ASCII code 239 = ´ ( Acute accent ) character will not display to the chat, if the character is located in the player's flavour text it will not allow examining of the player.

Numbered Steps to Reproduce Problem:

Load Paradise SS13 code. Use Set-Flavour-Text verb. Include the character ´ in the input somewhere. Your mob can no longer be examined. You can also just print ´ in the chat and the entire line will not print.

Expected Results:

At least something to print to the chat.

Actual Results:

Nothing is printed to the chat when the ´ character is included.

Does the problem occur:
Every time? Or how often? Every time
In other games? No
In other user accounts? Yes
On other computers? Yes

When does the problem NOT occur?
In the other BYOND games.

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.)

Uncertain, however, being not able to examine someone has been an issue dating back a few years which may have also been a result of this.

Workarounds:

Have yet to find any way to display ´ to the chat
This has to do with goonchat, a browser based chat interface paradise uses that isn't maintained by byond.

The raw source of the bug is when byond's url_encode() fails to properly encode the character, or produces output that the javascript portions can't read or understand.

Rather or not this is a byond bug or a javascript bug remains to be seen, but the javascript side produces the following error on /tg/station when using the ´ character, and we use the same goonchat:

MrStonedOne triggered JS error: Error: The URI to be decoded is not a valid encoding | url: http://127.0.0.1:63779/tmp5032/browserOutput.js | line: 161 | column: 2 | error: URIError: The URI to be decoded is not a valid encoding | user agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1; WOW64; Trident/7.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C; .NET4.0E)


uri_encode produces the following output

[14:41:50] <%MrStonedOne> !dm url_encode("blah´blah")
[14:41:53] <Bot32> TheAlmightyStoner: blah%c2%b4blah;


which might be part of the source of this error.
mob/verb/Ascii239()
src << url_encode("blah[ascii2text(239)]blah")

This produces the correct output "blah%efblah" for me. Although I should point out the acute accent character is 212, not 239.

I suspect the problem is that the page displayed by the browser control for this chat is using an encoding other than Windows 1292. In UTF-8 the sequence to encode B4 is C2 B4, which matches the output above. The JavaScript code is therefore sending UTF-8 to BYOND, which currently does not expect that encoding.
MSO's blah%c2%b4blah is likely due to sending UTF-8 over IRC to the bot that handles the !dm command - the bot doesn't do any encoding conversion, so if you feed it UTF-8 it'll feed UTF-8 to BYOND, and end up as %c2%b4.

WRT 239 vs 212, the acute accent's byte value changes depending on which character set you're using; in CP850, it's 239 (0xEF); in Windows-1252/ISO 8859-1 as well as Unicode, it's 180 (0xB4). I'm not sure which encoding it's 212 in - perhaps you got confused between 0xB4 and 0xD4?

world.log << url_encode("blah[ascii2text(180)]blah")
world.log << url_encode("blah´blah") // UTF-8 encoded; C2 B4
world.log << url_encode("blah´blah") // Windows-1252 encoded; B4

prints:
blah%b4blah
blah%c2%b4blah
blah%b4blah


on my system.

Additionally, trying to run decodeURI("blah%b4blah") in my browser's console returns a URIError, where decodeURI("blah%c2%b4blah") works as expected. I'd guess this is caused by JavaScript expecting URI-encoded strings to be UTF-8, where this string is whatever the server's default 8-bit locale is.
In response to GinjaNinja32
You're right, I confused B4 and D4; late night brainfart. B4 is 180.