Answer the question
In order to leave comments, you need to log in
How to properly set encoding for std::ifstream and std::string?
I work in RAD studio 10.4
. There is a utf8-encoded xml file from which you need to extract the necessary data and write it to sqlite.
As far as I know, std::ifstream reads the text in ANSI encoding, which is why the Cyrillic alphabet is confused and when sending data to sqlite (utf8 encoding is set in the database), the Cyrillic alphabet comes broken. At the same time, uploading to a txt file occurs without problems until subtsr is used (in one of the 4 txt files, Cyrillic is lost when using std::string::substr)
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question