Home » Community » Newbie corner » From std::string to String
From std::string to String [message #49458] |
Wed, 14 February 2018 14:35 |
Giorgio
Messages: 218 Registered: August 2015
|
Experienced Member |
|
|
Hi there,
in my application I read a text file with an Ansi codepage (Windows1252) and put part of the text in a vector of std::string. Later, I use those std::string to perform a simple SQL query:
std::vector<std::string> fields;
Insert(My_Table)(My_Field1, (String)fields[0])
(My_Field2, (String)fields[1])
(My_Field3, (String)fields[2]);
I have to cast from std::string to String (that is UTF8, if I remember correctly): I have an error compiling if I use std::string directly. The problem is that with "strange" characters (e.g. Ö) the string is not converted properly and in the DB I get unknown characters(�). How can I properly convert from std::string to String?
Thanks,
Gio
|
|
|
Goto Forum:
Current Time: Fri Apr 26 20:10:07 CEST 2024
Total time taken to generate the page: 0.02391 seconds
|