How can I convert text file to UTF-8 encoding ?
-
wrote on 10 Mar 2014, 12:09 last edited by
In Notepad++ you can choose from menu: Encoding -> Convert to UTF-8.
How can I do it with Qt ? -
Read the file, then open a new one and write the data using QTextStream set to UTF-8.
You can do this by getting the example from "QFile":http://qt-project.org/doc/qt-5/QFile.html documentation, and combining it with "QTextStream":http://qt-project.org/doc/qt-5/qtextstream.html#setCodec-2.
Once the new file is ready, close it, delete the original and move the new one to the old position.
1/2