# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-require 'iconv'
require 'timeout'
require 'tempfile'
require 'monitor'
require 'booh/config.rb'
require 'booh/version.rb'
+require 'glib2'
begin
require 'gtk2'
rescue LoadError, Gtk::InitError
def utf8(string)
begin
- return Iconv.conv("UTF-8", $CURRENT_CHARSET, string)
+ return GLib.convert(string, 'UTF-8', $CURRENT_CHARSET)
rescue
return "???"
end
def utf8cut(string, maxlen)
begin
- return Iconv.conv("UTF-8", $CURRENT_CHARSET, string[0..maxlen-1])
+ return GLib.convert(string[0..maxlen-1], 'UTF-8', $CURRENT_CHARSET)
rescue Iconv::InvalidCharacter
return utf8cut(string, maxlen-1)
rescue
end
def from_utf8(string)
- return Iconv.conv($CURRENT_CHARSET, "UTF-8", string)
+ return GLib.convert(string, $CURRENT_CHARSET, 'UTF-8')
end
def from_utf8_safe(string)
begin
- return Iconv.conv($CURRENT_CHARSET, "UTF-8", string)
+ return GLib.convert(string, $CURRENT_CHARSET, 'UTF-8')
rescue Iconv::IllegalSequence
return ''
end