Re: Writing a buffer with UTF-8 content.



I was wrong, any filesave method just saves into whatever encoding,
opening the resultant file in gedit gives an ecoding error and none
whatsoever encoding import helps.

When I edit the original with gedit I can open it (it is UTF-8)
and saving it will preserve all the locale strings in any language.



What I do is loading a file and put it in the keyfile object with:

keyFile.load_from_file(this._path, (GLib.KeyFileFlags.KEEP_COMMENTS
| GLib.KeyFileFlags.KEEP_TRANSLATIONS));

I can manipulate the resulting buffer with all the keyfile methods.
When I log the buffer to stdout, everything is preserved, but when I
write that same buffer to file it gets all garbled.


I really don't understand.
I also don't understand why there is no keyFile.to_file(); method.


-- 
(o_
//\  Regards, Groeten,
V_/_ Bas Burger.


On Thu, 26 Jul 2012 20:23:04 +0200
Yaa101 <yaa101 xs4all nl> wrote:

> I found the problem, faulty reference told me bufferlen has to be
> placed after buffer in aruments, this is not true.
> 
> Filewriting works, but also freaking ISO-8859-1 instead of UTF-8.
> 
> Translating encoding is no option as there are many locale in
> this .desktop file  that I have in buffer, and all need to be
> preserved.
> 
> I just want a UTF-8 buffer written to file, nothing more, that should
> be possible, no?
> 
> If not then I am speechless *facepalm*.
> 



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