Re: [gtkmm] unicode question



Hi,

Am Mit, 2002-09-18 um 22.21 schrieb Ollo:
> 
> Has anybody had some experience on parsing a Glib::usting
> containing unicode characters with libxml++??
> 
> I have a Glib::ustring that containes XML data.
> The tag contents may contain unicode characters.

UTF-8 encoded Unicode characters?

> (After all it's a vocabulary trainer I'm writing. <g>)
> 
> Now I don't seem to be able to parse this ustring with libxml.
> Each time the string contains anything exotic (like german umlauts)
> libxml++ cuts the string off and keeps only the part following and
> including the special character.
> 
> THE CODE:
> 
> Glib::ustring data;
> 		
> std::ifstream from(filename.c_str());
> if (!from) cout << "readerror\n";  // TODO inform user
> 
> char ch;
> while(from.get(ch)) data += ch;
> 
> // here the string still looks okay.

What does it mean, "looks still okay"?  How do you test that?
You may want to try data.validate() to be sure.

> XMLParser<OlvuParser> olvuParser;
> olvuParser.parse_chunk(data);

--Daniel





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