From: Robert Klemme Date: 2011-12-19T03:20:04+09:00 Subject: Re: Encoding problem, YARD and JSON On Sun, Dec 18, 2011 at 6:23 PM, Intransition wrote: > I have a Hash object I am trying to convert to JSON using the `json` gem. > Using #to_json I am getting this error: > >     in `encode': "\xC3" from ASCII-8BIT to UTF-8 > (Encoding::UndefinedConversionError) > > Most of the content of that hash is being extracted from the YARD api. > > Can anyone offer any idea on what the problem might be and how to fix? To me it sounds as if the particular String in question was obtained binary from the source (yard api probably) and there is a value which cannot be converted to UTF8 (maybe because it is > 0x7F). You could try correct encodings when fetching or force a particular encoding (e.g. one of the latin 8bit encodings) - if you _know_ the encoding. Kind regards robert -- remember.guy do |as, often| as.you_can - without end http://blog.rubybestpractices.com/