X2CommunityCore / X2SaveGameAnalyzer

Simple Windows application (and .NET library) that analyzes and displays some information from XCOM 2 savegame files.
GNU Lesser General Public License v3.0
6 stars 0 forks source link

String decoding algorithm does not consider unicode strings #5

Closed robojumper closed 5 years ago

robojumper commented 5 years ago

UE3 knows exactly two string encodings -- one is apparently the ISO-8859-1 encoding, the other is UTF-16-LE. Strings that can not be encoded with the former will instead use the latter with wide chars (two bytes per char). This is indicated by a negative string length -- the absolute value of the encoded length is the length in characters of the string, so if it's negative, you will have to read 2*abs(n) bytes and parse it as a UTF-16-LE string.

Decoding of the following file fails with an ArgumentOutOfRangeException: save_äẞü.zip

ẞ is the capital sharp s.