On Sat, 3 Nov 2007 10:38:22 -0500
AEtzold / gmx.de wrote:

> Dear all,
> 
> when using Iconv, I am repeatedly running into
> problems.
> I tried to run this bit of code:
> 
> #!/usr/bin/env ruby
> $KCODE = 'u'
> require 'iconv'
> 
> s = 'caff¡¯'
> 
> ic_ignore = Iconv.new('US-ASCII//IGNORE', 'UTF-8')
> puts ic_ignore.iconv(s) # => caff
> 
> ic_translit = Iconv.new('US-ASCII//TRANSLIT', 'UTF-8')
> puts ic_translit.iconv(s) # => caff`e
> 
> (from here:
> http://www.ruby-forum.com/topic/70827), 
> but instead of the promised result in the comments above,
> I am getting:
> 
> corr_ebook.rb:29:in `iconv': "\351" (Iconv::InvalidCharacter)
>         from corr_ebook.rb:29
> 
> Why ?
> I am using ruby 1.8.6 (2007-03-13 patchlevel 0) [x86_64-linux] (OpenSuse 10.2)
> 
> Thank you very much!


Your data is not UTF-8, from the error, most likely iso-8859-1 (or 15)

man iso_8859-1 shows octal 351 as expected.

351   233   E9          LATIN SMALL LETTER E WITH ACUTE

-jh