Skip to content

Commit c7f3e5f

Browse files
committed
Switch raw file encoding from ASCII to UTF-8
Updated all text-to-byte conversions to use UTF-8 encoding instead of ASCII when saving and handling raw file content. This change improves support for non-ASCII characters and ensures better compatibility with a wider range of text data.
1 parent 2a87907 commit c7f3e5f

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

Call of Duty FastFile Editor/Services/RawFileService.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -905,7 +905,7 @@ private string PromptForNewFileName(string currentName)
905905
/// </remarks>
906906
private void SaveFileNode(string ffFilePath, string zoneFilePath, RawFileNode rawFileNode, string updatedText, FastFileHeader headerInfo)
907907
{
908-
byte[] updatedBytes = Encoding.ASCII.GetBytes(updatedText);
908+
byte[] updatedBytes = Encoding.UTF8.GetBytes(updatedText);
909909
int updatedSize = updatedBytes.Length;
910910
int originalSize = rawFileNode.MaxSize;
911911

Call of Duty FastFile Editor/UI/MainWindowForm.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -859,7 +859,7 @@ private void filesTreeView_BeforeSelect(object sender, TreeViewCancelEventArgs e
859859
}
860860
else // DialogResult.No → discard changes
861861
{
862-
// Revert the nodes content back to the last‐loaded bytes
862+
// Revert the node's content back to the last‐loaded bytes
863863
var originalText = Encoding.UTF8.GetString(prevNode.RawFileBytes);
864864
prevNode.RawFileContent = originalText;
865865
prevNode.HasUnsavedChanges = false;
@@ -1108,7 +1108,7 @@ private ApplyChangesResult ApplyAllChangesToZone()
11081108
{
11091109
if (node.HasUnsavedChanges && !string.IsNullOrEmpty(node.RawFileContent))
11101110
{
1111-
byte[] newContent = Encoding.ASCII.GetBytes(node.RawFileContent);
1111+
byte[] newContent = Encoding.UTF8.GetBytes(node.RawFileContent);
11121112

11131113
// Handle internally compressed raw files (MW2 16-byte header format)
11141114
if (node.IsCompressed && node.CompressedSize > 0)

0 commit comments

Comments
 (0)