On Sun, Dec 18, 2011 at 6:23 PM, Intransition <transfire / gmail.com> 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:
>
> =A0 =A0 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



--=20
remember.guy do |as, often| as.you_can - without end
http://blog.rubybestpractices.com/