[glade--]how to handle UTF-8 on glademm



Hi all,

I would like to ask you (especially whose mother language is not English)
about charater set, UTF-8, etc.

I am Susumu ,a Japanese guy who is coding on glademm(2.0.0).
I have been failing to show Japanese characters on textview or treeview.
What is show below is the experiment I did with a textview widget.
(I wrote some Japanese words instead of "*****")

---- sample code starts here ----

#include <string>

  .....
  .....

  std::ofstream ofs("temp",std::ios::out | std::ios::trunc);
  //ofs <<  entry1->get_text().c_str();

  //ofs << "*****" << std::endl;

  std::string str = "abcde";
  Glib::ustring ustr = "abcde";
  std::ifstream ifs("tmp_in", std::ios::in | std::ios::binary);

  ofs << str << std::endl;
  //ofs << ustr << std::endl;

  //  ifs >> str;
  ifs >> ustr;
  
  //  entry2->set_text(str);
  entry2->set_text(ustr);

----- sample code ends here ----

Results are :
1. ofs << "*****" << std::endl; was successful
2. all  ofs << str << std::endl;  ,  ofs << ustr << std::endl;
   entry2->set_text(str);  and   entry2->set_text(ustr);
   were successful
3. as soon as I put some Japanese words instead of "abcde",
   all  ofs << str << std::endl;  and  ofs << ustr << std::endl;
   entry2->set_text(str);  and   entry2->set_text(ustr);
   failed

   Error message is as below :

(exp1:12219): glibmm-CRITICAL **: 
unhandled exception (type Glib::Error) in signal handler:
domain: g_convert_error
code  : 1
what  : invalid row of bites in the input to convert


I believe we can use non-ASCII characters on glademm and gtkmm but
is it wrong?
Can't I display any Japanese characters on a textview?
I don't know how to handle UTF-8 strings.
And I want to input and output EUC encoded charaters if possible
(because LaTeX doesn't support UTF-8 yet)
Please help me.

-- 
from Susumu Yoshida(susumu yt com)
Powered by Red Hat Linux



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