Skip to content

Commit

Permalink
Preserve charset of non-UTF-8, CRLF files when saving
Browse files Browse the repository at this point in the history
Make sure to use the correct charset when opening msgcat-formatted file
that needs to be saved with CRLF line endings.

Fixes #325.
  • Loading branch information
vslavik committed Jan 24, 2017
1 parent f894766 commit d9bdb78
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/catalog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1591,9 +1591,10 @@ bool Catalog::Save(const wxString& po_file, bool save_mo,
// msgcat always outputs Unix line endings, so we need to reformat the file
if (msgcat_ok && outputCrlf == wxTextFileType_Dos)
{
wxCSConv conv(m_header.Charset);
wxTextFile finalFile(po_file_temp2);
if (finalFile.Open())
finalFile.Write(outputCrlf);
if (finalFile.Open(conv))
finalFile.Write(outputCrlf, conv);
}

if (!TempOutputFileFor::ReplaceFile(po_file_temp2, po_file))
Expand Down

0 comments on commit d9bdb78

Please sign in to comment.