Fwd: Bug with g_file_load/replace_contents and utf-8



Hello,

I have been porting a part of a program to GIO for file monitoring. By
this move I also switched g_file_get/set_contents to the ones
available in the GFile object, g_file_load/replace_contents.

At the first run I was surprised that it didn't work (of course errors
may always be introduced ;-)). Well looks like the code was ok. The
problem is that I read and save files with utf-8 characters and that
is kind of broken here. I reproduced the problem on two machines, one
with glib-2.20.1 and another with glib 2.20.3. I ran a smaller test
case, one in C as my program and another with Python. Turns out the
one in Python doesn't reproduce the problem and I really have no clue
what is going on. The test cases in C and Python are attached.

I hope I'm not the only one reproducing the problem :)

Mike

Attachment: test.c
Description: Text document



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