Permalink
Browse files

avoid ArgumentError: invalid byte sequence in UTF-8

  • Loading branch information...
1 parent b3701de commit 461a6e284fb8122433c22eddd5d865c7c1bbe20e @znz znz committed May 23, 2012
Showing with 5 additions and 1 deletion.
  1. +5 −1 plugins/titlebot.nb
View
@@ -93,7 +93,11 @@ module URL2Title
when /euc-jp/i # euc-jp, x-euc-jp
charset = "eucjp-ms"
end
- if charset
+ if /\Autf-8\z/i =~ charset
+ # avoid #<ArgumentError: invalid byte sequence in UTF-8>
+ # or Iconv::IllegalSequence
+ body = NKF.nkf("-Wwm0x", body)
+ elsif charset
charset.sub!(/\Ax-?/i, '')
body = Iconv.conv("utf-8", charset, body)
else

0 comments on commit 461a6e2

Please sign in to comment.