Skip to content

Commit

Permalink
Merge pull request #7 from codepwner/patch-2
Browse files Browse the repository at this point in the history
Trim Null Padded Variable Names
  • Loading branch information
Markeli authored Nov 13, 2023
2 parents 2785794 + 042048c commit 79ef5ee
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/Curiosity.SPSS/FileParser/Records/EncodingExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace Curiosity.SPSS.FileParser.Records
internal static class EncodingExtensions
{
/// <summary>
/// Gets a decoded string, with trailing spaces trimmed out
/// Gets a decoded string, with trailing spaces and null characters trimmed out
/// </summary>
internal static string GetTrimmed(this Encoding enc, byte[] arr)
{
Expand All @@ -23,7 +23,7 @@ internal static string GetTrimmed(this Encoding enc, byte[] arr)
throw new ArgumentNullException(nameof(arr));
}

return enc.GetString(arr).TrimEnd();
return enc.GetString(arr).TrimEnd('\0').TrimEnd();
}


Expand Down Expand Up @@ -218,4 +218,4 @@ private static byte[] GetPaddedByteArray(Encoding enc, int length, byte padding,
return byteArr;
}
}
}
}

0 comments on commit 79ef5ee

Please sign in to comment.