Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.ruby > #7388

Encoding Convertor failed for utf-7 to utf-8

Newsgroups comp.lang.ruby
Date 2018-05-09 07:52 -0700
Message-ID <3fef5789-43e4-48a6-9481-3f1dee611883@googlegroups.com> (permalink)
Subject Encoding Convertor failed for utf-7 to utf-8
From Suresh G <sureshggg@gmail.com>

Show all headers | View raw


Hi,

I am getting Encoding::ConverterNotFoundError, when try to convert utf-7 string to utf-8.

I have a requirements of parsing the email and display the the email in rails app. I am using the gem https://github.com/mikel/mail for parsing the email. This is looking like core ruby issue, I thought to discuss understand here.

Can somebody explain why there is no default converter for utf-7 to utf-8?. As utf-7 is mostly used in Emails, this should be there by default. If there is option to write custom Encoding::Converter, what is the procedure for it, I couldn't get something in docs.

Ruby Version:2.3.o

Irb:

2.3.0 :053 > "".force_encoding('utf-7').encode('utf-8')
Encoding::ConverterNotFoundError: code converter not found (UTF-7 to UTF-8)
	from (irb):53:in `encode'
	from (irb):53
	from /Users/suresh.gnanasekar/.rvm/rubies/ruby-2.3.0/bin/irb:11:in `<main>'


Thanks,
Suresh G

Back to comp.lang.ruby | Previous | NextNext in thread | Find similar


Thread

Encoding Convertor failed for utf-7 to utf-8 Suresh G <sureshggg@gmail.com> - 2018-05-09 07:52 -0700
  Re: Encoding Convertor failed for utf-7 to utf-8 Robert Klemme <shortcutter@googlemail.com> - 2018-05-10 13:06 +0200
    Re: Encoding Convertor failed for utf-7 to utf-8 Suresh G <sureshggg@gmail.com> - 2018-05-10 23:41 -0700

csiph-web