-
Notifications
You must be signed in to change notification settings - Fork 939
Iso 2022 jp - implement charset codec #595
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
base: master
Are you sure you want to change the base?
Conversation
These patches introduce some special treatments for ISO-2022-JP encoding (so-called JIS-code), which is the de facto standard when we send an email written in Japanese language. These patches have effects only when a Mail object is instanciated with :charset => 'ISO-2022-JP' option. With this option, the header values and body text are automatically converted from UTF-8 to ISO-2022-JP. Note that some characters are replaced with other characters before this conversion takes place in order to solve problems on some platforms. See https://github.com/kuroda/mail-iso-2022-jp for details.
Nice work. Thank you! It's good to see big blocks of red in the diff. |
end | ||
|
||
def set_charset_on(message) | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be a !
method?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On further review, this doesn't look like the codec's responsibility.
The codec is converting "messy" external encoding to a clean internal encoding.
So the codec should expose its internal charset, then have calling code do something like message.charset = codec.charset
instead of codec.set_charset_on message
.
I made some comments on method naming and separation of responsibilities. Thanks again! 👍 |
Hey @yujiyokoo, @kuroda and @mikel 👋 One of our users over at https://github.com/zammad/zammad stumbled across this issue earlier this year and now one of our paying customers is affected as well. Therefore this topic gets a certain priority and we were wondering what we can contribute to enable this great gem to support Iso 2022 jp mails. Could you please give us a short update on the current state of this PR - which seems to be staled for nearly 6 years by now. We'd like to pick things up and get this merged into the latest version. Looking forward do hear from you. Bests, Thorsten |
The I managed to make this gem work, but I did not have a solid understanding of the internal structure. So I couldn't answer the question from @jeremy. I think it is very difficult to save this six year old PR. |
Yeah I think @kuroda is right. It's very hard to save such an old PR. Back then, I tried working on this for a while, and was intending to do more work on it but unfortunately other things got prioritised over it and I didn't know a lot about the internals of this either :( |
With help from @kuroda and @mikel, I have implemented the CharsetCodec which @jeremy suggested in the original PR (#534).
I have simply moved things around - it should work exactly the same as the original iso-2022-jp branch AFAIK.