else
type = entry2type(file)
if type && !xmldir.elements["#{type}[@filename='#{utf8(file)}']"]
- xmldir.add_element type, { "filename" => utf8(file), "caption" => $empty_comments ? '' : utf8(file.sub(/\.[^\.]+$/, '')[0..17]) }
+ xmldir.add_element type, { "filename" => utf8(file), "caption" => $empty_comments ? '' : utf8cut(file.sub(/\.[^\.]+$/, ''), 18) }
end
end
end
return Iconv::iconv("UTF-8", $CURRENT_CHARSET, string).to_s
end
+ def utf8cut(string, maxlen)
+ begin
+ return Iconv::iconv("UTF-8", $CURRENT_CHARSET, string[0..maxlen-1]).to_s
+ rescue Iconv::InvalidCharacter
+ return utf8cut(string, maxlen-1)
+ end
+ end
+
def sizename(key)
#- fake for gettext to find these; if themes need more sizes, english name for them should be added here
sizenames = { 'small' => utf8(_("small")), 'medium' => utf8(_("medium")), 'large' => utf8(_("large")),