Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for charset #81

Open
ehlyzov opened this issue Apr 23, 2015 · 0 comments
Open

Support for charset #81

ehlyzov opened this issue Apr 23, 2015 · 0 comments

Comments

@ehlyzov
Copy link

ehlyzov commented Apr 23, 2015

If I use search options which are not 'ascii-8bit' encoded, server response is:

[1] pry(main)> mailbox.inbox.emails(gm: 'Привет из Питера!')
Encoding::CompatibilityError: incompatible encoding regexp match (ASCII-8BIT regexp with UTF-8 string)

String#force_encoding can be used, but in this case Gmail must be aware of original encoding. Otherwise it response with Net::IMAP::BadResponseError: Could not parse command

So I patched Mailbox#emails (master...ehlyzov:master#diff-41778eca41b3a50379aa723a35b177db) but I don't sure if opts is a good place for charset configuration. Maybe it is better to create the mailbox attribute. What do you think?

Anyway, with this change following code looks clumsy, but it works:

mailbox.inbox.emails(gm: 'Привет из Питера!'.force_encoding('ascii-8bit'), charset: 'UTF-8')

Probably it would be better to make this default behaviour, can't imagine any drawbacks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant