Changeset be3e9b4bbc5b5c2b45798231ad6969467ced33be

Show
Ignore:
Timestamp:
01/06/07 23:44:34 (6 years ago)
Author:
Philipp Kern <phil@…>
Parents:
8ec5e5b8e91a297ee88701fd15d81a93a52b4810
Children:
7bf4916ab93fbcb1e951abeeaf7bb1cf7bf96207
git-committer:
Philipp Kern <phil@0x539.de> / 2007-01-06T22:44:34Z+0000
Message:

[project @ Check for valid UTF-8 after converting]

Original author: Armin Burgmeier <armin@…>
Date: 2005-07-25 12:07:30+00:00

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • src/encoding.cpp

    r8ec5e5b rbe3e9b4  
    6969Glib::ustring Gobby::Encoding::convert_to_utf8(const std::string& str) 
    7070{ 
    71         return Glib::convert(str, "UTF-8", m_name); 
     71        Glib::ustring utf8 = Glib::convert(str, "UTF-8", m_name); 
     72        if(!utf8.validate() ) 
     73        { 
     74                throw Glib::ConvertError( 
     75                        Glib::ConvertError::NO_CONVERSION, 
     76                        "Couldn't convert to UTF_8" 
     77                ); 
     78        } 
     79        return utf8; 
    7280} 
    7381