SDG Blog

It's pronounced "Boo-Ack"!

Unturned's Main Menu Banner Fail

This gets a big facepalm so I decided to write what happened.

For the Pride Month event and the Firefigher Plushie launch there were supposed to be banners on the main menu. Nobody noticed they were missing because only I knew they were setup, and I didn't notice them missing because the "live config" settings were being loaded locally. Fortunately this came to light before too long when Molt pointed out WeslieG's arena event banner wasn't working. Here's how they were supposed to appear:

The reason this broke is when tidying a few things up in June I added "charset=utf-8" to --content-type "text/plain; charset=utf-8" for the live config file. The file itself doesn't have a byte order mark (BOM), but with UTF-8 encoding specified S3 began inserting the UTF-8 BOM. On the client Unturned was parsing DownloadHandler.text which includes the BOM, so the first line of text - which happens to be the main menu banner - contained garbage and wasn't parsed.

Fortunately as a temporary workaround to avoid a patch I removed charset from the content type header. To avoid problems like this in the future I've changed the client to parse instead and use StreamReader to handle BOM, and I'll add some unit tests for parsing strings that contain BOM.