UTF-8 Questions



Hello, Everyone

  I stored some files as byte array in a self-defined file. I want to write a 
program. When it needed, the byte array can be saved back to seperate files 
(So I must reserve the exact array, not converting from charset to charset), 
or it can be put into a GtkTextBuffer to show and edit. My problem is now 
when a file byte array is composed with only ascii chars, when the byte array 
is convert to Char array, the GtkTextBuffer can display the content very 
good. But, when the file byte array is composed with some other chars, such 
as a Chinese Char, the GtkTextBuffer display nothing.

  with a line(pascal code):
utf8_str:=g_locale_to_utf8(PGChar(textcont),size,NULL,NULL,@error1);
writeln('>>> Error Message: ', error1^.message);

  It prints that invalid character sequence occured when converting the input 
string. But what I need is to display everything, no mind what it is like. 
For an example, you can open and display file of ANY TYPE with kate, even a 
a.out binary file. But it seems impossible in Gtk2.

  Am I wrong? Help me.

  Yours,
  mili



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