| 41 | namespace CharSetDetect { |
| 42 | |
| 43 | std::string GetEncoding(agi::fs::path const& filename) { |
| 44 | auto encoding = agi::charset::Detect(filename); |
| 45 | if (!encoding.empty()) |
| 46 | return encoding; |
| 47 | |
| 48 | auto choices = agi::charset::GetEncodingsList<wxArrayString>(); |
| 49 | int choice = wxGetSingleChoiceIndex( |
| 50 | _("Aegisub could not narrow down the character set to a single one.\nPlease pick one below:"), |
| 51 | _("Choose character set"), |
| 52 | choices); |
| 53 | if (choice == -1) throw agi::UserCancelException("Cancelled encoding selection"); |
| 54 | return from_wx(choices[choice]); |
| 55 | } |
| 56 | |
| 57 | } |
no test coverage detected