projects
/
booh
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
02fa14d
)
do not abort on incorrect filenames in filesystem
author
Guillaume Cottenceau
<gcottenc@gmail.com>
Tue, 15 Sep 2009 13:31:17 +0000
(15:31 +0200)
committer
Guillaume Cottenceau
<gcottenc@gmail.com>
Tue, 15 Sep 2009 13:31:17 +0000
(15:31 +0200)
lib/booh/booh-lib.rb
patch
|
blob
|
history
diff --git
a/lib/booh/booh-lib.rb
b/lib/booh/booh-lib.rb
index 8c246aa841f3ec2c6a0835cb85a1858a5a06611f..54cc077f1086873176373905044dd8f5cc2f6eeb 100644
(file)
--- a/
lib/booh/booh-lib.rb
+++ b/
lib/booh/booh-lib.rb
@@
-54,7
+54,11
@@
module Booh
$convert_enhance = '-contrast -enhance -normalize'
def utf8(string)
- return Iconv::iconv("UTF-8", $CURRENT_CHARSET, string).to_s
+ begin
+ return Iconv::iconv("UTF-8", $CURRENT_CHARSET, string).to_s
+ rescue
+ return "???"
+ end
end
def utf8cut(string, maxlen)
@@
-62,6
+66,8
@@
module Booh
return Iconv::iconv("UTF-8", $CURRENT_CHARSET, string[0..maxlen-1]).to_s
rescue Iconv::InvalidCharacter
return utf8cut(string, maxlen-1)
+ rescue
+ return "???"
end
end