Skip to content

Commit 40339ef

Browse files
committed
Minor update
1 parent 512ff4d commit 40339ef

2 files changed

Lines changed: 4 additions & 13 deletions

File tree

App/EncodingChecker.exe

0 Bytes
Binary file not shown.

sources/EncodingChecker/MainForm.cs

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -77,20 +77,11 @@ private void OnFormLoad(object sender, EventArgs e)
7777
lstValidCharsets.Items.Add(encoding.WebName);
7878
lstConvert.Items.Add(encoding.WebName);
7979
// add UTF-8/16 with BOM, right after UTF-8/16
80-
if (encoding.WebName == "utf-8")
80+
const string pattern = "^utf-16BE|utf-16|utf-8$";
81+
if (Regex.IsMatch(encoding.WebName, pattern))
8182
{
82-
lstValidCharsets.Items.Add("utf-8-bom");
83-
lstConvert.Items.Add("utf-8-bom");
84-
}
85-
else if (encoding.WebName == "utf-16")
86-
{
87-
lstValidCharsets.Items.Add("utf-16-bom");
88-
lstConvert.Items.Add("utf-16-bom");
89-
}
90-
else if (encoding.WebName == "utf-16BE")
91-
{
92-
lstValidCharsets.Items.Add("utf-16BE-bom");
93-
lstConvert.Items.Add("utf-16BE-bom");
83+
lstValidCharsets.Items.Add(encoding.WebName + "-bom");
84+
lstConvert.Items.Add(encoding.WebName + "-bom");
9485
}
9586
}
9687
catch

0 commit comments

Comments
 (0)