colorit 0.3.3 → 0.3.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,8 @@
1
1
 
2
+ ## 0.3.4
3
+
4
+ * fixed error "invalid byte sequence in UTF-8"
5
+
2
6
  ## 0.3.2
3
7
 
4
8
  * added support for ~/.coloritrc (thanks to [winks](https://github.com/winks))
@@ -10,7 +10,12 @@ class String
10
10
  Colorit::Colors.all[color] + $& + Colorit::Colors.reset()
11
11
  end
12
12
  rescue ArgumentError
13
- # rescue from invalid byte sequence in UTF-8
13
+ require 'iconv'
14
+
15
+ # rescue from invalid byte sequence in UTF-8 and convert it to UTF-8
16
+ # and ignore these sequences to get a safe string
17
+ ic = Iconv.new("UTF-8//IGNORE", "UTF-8")
18
+ ic.iconv(self).colorize(pattern, color)
14
19
  end
15
20
  end
16
21
  end
@@ -1,3 +1,3 @@
1
1
  module Colorit
2
- VERSION = %w(0 3 3)
2
+ VERSION = %w(0 3 4)
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: colorit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.3
4
+ version: 0.3.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-12-18 00:00:00.000000000 Z
12
+ date: 2012-12-19 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: colorit colors your console outputs using regular expressions to emphasize
15
15
  special words in e.g. logfiles