fix compatibility with ruby-1.9.3
tests for line number in error message
polished line numbers and amended test
fixed line numbers and amended test for encoding error