Re: Writing a buffer with UTF-8 content.



After some more experimenting, I maybe have a hunch.
Could it be that something goes wrong between keyfile handing over it's
buffer and putting that in a javascript string?
The input file is 17809
The keyfile.to_data() tells that the number of bytes is 17838 after
adding "blahblah"
The javascript string, after receiving the data, reports 13961 with
string.length

I tried to feed the keyfile.to_data() directly into the
GLib.file_set_contents, but I think it still uses a javascript string.

To be continued...

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


On Fri, 27 Jul 2012 00:50:48 +0200
Yaa101 <yaa101 xs4all nl> wrote:

> 
> Sorry, I had to unload frustration. :-)
> 
> Attached you will find a test case script to prove my point.
> 
> 
> This script is to show that writing a keyfile will garble the content
> of the output file, while logging to stdout will not.
> 
> It reads the gedit-in.desktop file into a keyfile object.
> If the file is loaded there will be a string "blahblah" set in your
> current locale to the buffer inside keyfile. Last part writes this
> buffer to a new file called gedit-out.desktop and also logs the buffer
> to stdout.
> 
> On my machine and my locale (nl_NL.UTF-8) it fails to leave the
> desktop file in the same condition as it found. There should only be
> an addition of Name[nl_NL.UTF-8]=blahblah. You can find the results
> of my machine (mageia 2, gnome 3.4.1) as gedit-out-failed.desktop.
> 
> If your gedit-out.desktop looks like your gedit-in.desktop then
> something is wrong here. If it looks like gedit-out-failed.desktop
> then something is either wrong with the code in this script or there
> is a bug.
> 
> If you load gedit-in.desktop into gedit then you see all the
> translations in their own font (if you installed that font) or
> numbered utf blocks. If you save that after manipulation, it will not
> garble up the resultant content after file save. I assume that gedit
> uses the same libraries as we do, so unless it has a proprietary
> function to save, there is something I do wrong.
> 
> If you know, please tell me.
> 



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