private void change_encoding(int new_codepage) { if (text_provider == null) { return; } text_provider.Dispose(); open_view(file_name, Encoding.GetEncoding(new_codepage)); foreach (MenuItem menu_item in menuItemEncodingOther.MenuItems) { if (menu_item.Checked) { menu_item.Checked = false; } if (((Encoding_DisplayInfo)menu_item.Tag).EncodingInfo.CodePage == new_codepage) { menu_item.Checked = true; } } Options.CodePage = new_codepage; }