imathis/octopress — Issue #258: raw.rb execption on utf-8 input
Author: usharf
Created: 2011-11-01 18:02:16+00:00
State: open

I'm not yet sure what is the problem with the source data, but gsub (in raw.rb -> unwrap(input)) raises exceptions which are not being caught, and thus the "rake generate" process can not finish. While it requires further investigation, I've used rescue Exception to let it continue.

The source data validates as utf-8, and I also sanitized it with the following (and with iconv before that):

```ruby
content = post[:body].encode("UTF-8",
:invalid => :replace,
:undef => :replace,
:replace => "?")
```

but with no luck.

This is the dump for the exception raised by unwrap for bad data:

```ruby
puts "Exception #{$1} at: #{$@} dump #{input}"
```
```
Exception at: ["/Users/uri/Projects/lemag/octopress/plugins/raw.rb:11:in `gsub'", "/Users/uri/Projects/lemag/octopress/plugins/raw.rb:11:in `unwrap'", "/Users/uri/Projects/lemag/octopress/plugins/octopress_filters.rb:18:in `post_filter'", "/Users/uri/Projects/lemag/octopress/plugins/octopress_filters.rb:30:in `post_render'", "/Users/uri/Projects/lemag/octopress/plugins/post_filters.rb:124:in `block in post_render'", "/Users/uri/Projects/lemag/octopress/plugins/post_filters.rb:123:in `each'", "/Users/uri/Projects/lemag/octopress/plugins/post_filters.rb:123:in `post_render'", "/Users/uri/Projects/lemag/octopress/plugins/post_filters.rb:151:in `transform'", "/Users/uri/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/jekyll-0.11.0/lib/jekyll/convertible.rb:84:in `do_layout'", "/Users/uri/Projects/lemag/octopress/plugins/post_filters.rb:167:in `do_layout'", "/Users/uri/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/jekyll-0.11.0/lib/jekyll/post.rb:189:in `render'", "/Users/uri/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/jekyll-0.11.0/lib/jekyll/site.rb:193:in `block in render'", "/Users/uri/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/jekyll-0.11.0/lib/jekyll/site.rb:192:in `each'", "/Users/uri/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/jekyll-0.11.0/lib/jekyll/site.rb:192:in `render'", "/Users/uri/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/jekyll-0.11.0/lib/jekyll/site.rb:40:in `process'", "/Users/uri/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/jekyll-0.11.0/bin/jekyll:250:in
`'", "/Users/uri/.rbenv/versions/1.9.2-p290/bin/jekyll:20:in `load'", "/Users/uri/.rbenv/versions/1.9.2-p290/bin/jekyll:20:in `

'"]
```