Re: Writing a buffer with UTF-8 content.



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.

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




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

> The more I try the less I understand.
> 
> When I convert the buffer explicitly from utf-8 to utf-8 the results
> stay the same.
> 
> When I log the buffer to stdout, all the encoding stays well and all
> the locales are seen in their own fonts (I got most fonts of the world
> installed), when written to file all faults up.
> 
> AAAAAAAAAAAAAARRRRRRRRRRRRRRRGGGGGGGGGGGGGGGGGG!!!!!!!!!!!!!!!!!!
> 
> 
> 

Attachment: test_glib_write.zip
Description: Zip archive



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