I am trying to read from a ISO-8859-1 file and convert to UTF-8 before parsing it. I looked for some examples using Boost locale (example below), but couldn't make it work.
What is the recommended way for handling this case?
DefFile parse(std::istream &input);
int main(int argc, char *argv[]) {
std::fstream file;
boost::locale::generator gen;
gen.categories(boost::locale::codepage_facet | boost::locale::convert_facet);
file.imbue(gen.generate("pt_BR.ISO-8859-1"));
file.open("RD2008.DEF", std::fstream::in);
auto df = parse(file);
// ... do some work
}
Aucun commentaire:
Enregistrer un commentaire