mirror of https://github.com/odrling/Aegisub
Fix charset detection and conversion issues
This commit is contained in:
parent
8165f1ad5e
commit
1ad2d838ad
|
@ -22,7 +22,6 @@ namespace agi {
|
|||
line_iterator_base::line_iterator_base(std::istream &stream, std::string encoding)
|
||||
: stream(&stream)
|
||||
{
|
||||
boost::to_lower(encoding);
|
||||
if (encoding != "utf-8") {
|
||||
agi::charset::IconvWrapper c("utf-8", encoding.c_str());
|
||||
c.Convert("\r", 1, reinterpret_cast<char *>(&cr), sizeof(int));
|
||||
|
|
|
@ -47,8 +47,11 @@ namespace CharSetDetect {
|
|||
|
||||
std::string GetEncoding(agi::fs::path const& filename) {
|
||||
auto encoding = agi::charset::Detect(filename);
|
||||
if (!encoding.empty())
|
||||
if (!encoding.empty()) {
|
||||
if (!encoding.compare("ASCII") || !encoding.compare("UTF-8"))
|
||||
encoding = "utf-8";
|
||||
return encoding;
|
||||
}
|
||||
|
||||
auto choices = agi::charset::GetEncodingsList<wxArrayString>();
|
||||
int choice = wxGetSingleChoiceIndex(
|
||||
|
|
Loading…
Reference in New Issue