mirror of
https://github.com/odrling/Aegisub
synced 2025-04-11 22:56:02 +02:00
Fix charset detection and conversion issues
This commit is contained in:
parent
61ec2bc3e7
commit
ce655fab8d
@ -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…
x
Reference in New Issue
Block a user