Re: Save files with correct character set



On Thu, 22 Mar 2012 13:43:48 +0000 Chris wrote:
> On Thu, 22 Mar 2012 00:58:01 +0100
> Spazzatura.Live <kharhonte hotmail com> wrote:
> > I'm trying to save the content of a Glib::ustring to a file. I tried 
> > using the Glib::file_set_contents but it uses the std::string, and so
> > it writes a non-unicode file.
> 
> That's wrong.  The std::string object will hold whatever encoding you
> put in it.  std::string objects just hold octets.
> 
That slightly depends what the OP meant by "a non-unicode file". It
will write the file with the contents of the Glib::ustring, which is
UTF-8. The resulting file will be an unembellished UTF-8 file, which a
lot of Micro$oft tools will declare to be plain ASCII because it
explicitly isn't UCS-2. Of course, if that's what he means then it's
not Glib that's broken....

Rob


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]