Skip to content

Commit

Permalink
Ask QTextStream to decode text as UTF-8
Browse files Browse the repository at this point in the history
Also allow wider Unicode encodings in case a BOM is present.

Closes #1692.

(cherry picked from commit 7ac42b0)
  • Loading branch information
lmoureaux committed Jan 14, 2023
1 parent fa49a40 commit 990ec6d
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions utility/inputfile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,8 @@ struct inputfile *inf_from_stream(QIODevice *stream,
inf->filename.clear();
inf->fp = stream;
inf->stream = new QTextStream(stream);
inf->stream->setCodec("UTF-8");
inf->stream->setAutoDetectUnicode(true); // Allow UTF-16 and UTF-32
inf->datafn = datafn;

qCDebug(inf_category) << "opened" << inf_filename(inf) << "ok";
Expand Down

0 comments on commit 990ec6d

Please sign in to comment.