iconv-lite icon indicating copy to clipboard operation
iconv-lite copied to clipboard

Add ISO-2022-JP encoding

Open ashtuchkin opened this issue 10 years ago • 28 comments

Needs a separate, stateful codec, so probably will not implement without a sign of significant usage.

ashtuchkin avatar May 18 '14 23:05 ashtuchkin

Today I ran into this when trying to parse my gmail .mbox (https://support.google.com/accounts/answer/3024195?hl=en) with the https://www.npmjs.org/package/mbox-stream module which uses https://www.npmjs.org/package/mailparser which uses iconv-lite

[Error: Encoding not recognized: 'ISO-2022-JP' (searched as: 'iso2022jp')]

max-mapper avatar Nov 07 '14 13:11 max-mapper

Ah actually I forgot to also mention that mailparser uses https://www.npmjs.org/package/encoding which in turn uses iconv-lite, but encoding is supposed to be normalization layer around iconv and iconv-lite so it shouldn't have crashed here. Seems like a bug in encoding, i'll file an issue there as well

max-mapper avatar Nov 07 '14 13:11 max-mapper

AFAIK, you just need to install node-iconv yourself for encoding module to use it. Let me know if it helped.

ISO-2022-JP is a rare encoding nowadays and is quite different in structure than most others (its stateful), so to support it I'd need to write separate codec. I didn't want to make these efforts until at least a couple of people said they need it. Your vote is the first for now) On Nov 7, 2014 5:05 AM, "Max Ogden" [email protected] wrote:

Ah actually I forgot to also mention that mailparser uses https://www.npmjs.org/package/encoding which in turn uses iconv-lite, but encoding is supposed to be normalization layer around iconv and iconv-lite so it shouldn't have crashed here. Seems like a bug in encoding, i'll file an issue there as well

— Reply to this email directly or view it on GitHub https://github.com/ashtuchkin/iconv-lite/issues/60#issuecomment-62139268 .

ashtuchkin avatar Nov 07 '14 23:11 ashtuchkin

I'll throw my vote in here. Just ran into the same error.

coyle avatar Dec 01 '14 16:12 coyle

Got it! Thanks

Alexander Shtuchkin

On Mon, Dec 1, 2014 at 8:24 AM, coyle [email protected] wrote:

I'll throw my vote in here. Just ran into the same error.

— Reply to this email directly or view it on GitHub https://github.com/ashtuchkin/iconv-lite/issues/60#issuecomment-65090106 .

ashtuchkin avatar Dec 01 '14 16:12 ashtuchkin

Would love to get it supported as well :+1:

AVVS avatar Mar 09 '15 00:03 AVVS

Casting my vote in support as well, our node-fetch uses encoding which uses iconv-lite by default, I found out about this on production server today, installing iconv certainly helps resolving this issue :)

bitinn avatar May 16 '15 15:05 bitinn

Just adding my vote for this issue as well. This appears to be an encoding that's used widely enough in email that it has become a would-be really-really-really-nice-to-have for my application.

I will look into what writing a new codec for this encoding involves and if possible will write one myself and submit a pull request.

EDIT: Scratch that, it looks like node-iconv already supports this so I'll go with that for now.

asleepysamurai avatar Jul 23 '15 07:07 asleepysamurai

vote for this.

lygstate avatar Jan 14 '16 23:01 lygstate

I also vote for this, it would be great to have since i run into this problem every time i deal with japanese emails.

AdrianTudC avatar Feb 15 '16 11:02 AdrianTudC

You get my vote. Just ran into this issue.

Atm0sf3ar avatar Jul 17 '17 08:07 Atm0sf3ar

Also my vote for this, just ran into same situation. => need to use both iconv-lite & iconv at the same time which I don't like! 💀

nnabinh avatar Nov 20 '17 03:11 nnabinh

Another vote! Also dealing with emails.

kevincupp avatar Feb 28 '18 03:02 kevincupp

As of now, in AWS Lambda, using the packages depend on native module such as node-iconv is quite a bit hard or tricky, so I wanna use iconv-lite rather than it if I can.

issei-m avatar May 16 '18 22:05 issei-m

As MailParser (https://github.com/nodemailer/mailparser) depends on this module, Japanese mails sent from outlook cannot be converted correctly with it. Supporting ISO-2022-JP is very important for Japanese user!

mazamachi avatar Sep 11 '18 11:09 mazamachi

My vote for this.

misteral avatar Dec 23 '18 13:12 misteral

I also want iso-2022-jp support on iconv-lite.

As mentioned by another reporter, MailParser depends on iconv-lite for decoding message body.

And also libmime depends on iconv-lite for decoding 'encoded-word' (defined at RFC 2047) like:

  • =?iso-2022-jp?B?GyRCNElNfSQ3JD8lOyUtJWUlaiVGJSNCUDp2JEdCUDF+JE4/V0IuGyhC?= which should be decoded like: 管理したセキュリティ対策で対応の迅速
const iconv = require('iconv-lite');
...
        return iconv.decode(buf, fromCharset);

https://github.com/nodemailer/libmime/blob/a0a84a429e68f206bae4172c4cc1a38d3930c369/lib/charset.js#L37

kenjiuno avatar Jan 29 '19 08:01 kenjiuno

I'm going to throw in my vote here. I could use iso-2022-jp support

mjmayer avatar Jul 24 '19 21:07 mjmayer

I also use MailParser and hope iconv-lite can support iso-2022-jp, many thanks

chenxiaoba avatar Nov 20 '19 03:11 chenxiaoba

Please, add my vote as well.

Error: Encoding not recognized: 'ISO-2022-JP' (searched as: 'iso2022jp')

DigitalLeaves avatar Jul 14 '20 09:07 DigitalLeaves

This issue has been open for a pretty long time :(

Would also like to add myself to the list of "someone asks".

CExAdamJ avatar Jul 30 '20 15:07 CExAdamJ

Notes: both mailparser and libmime packages fixed iso-2022-jp decoding problem by importing encoding-japanese package:

  • mailparser
    • https://github.com/nodemailer/mailparser/commit/b91e70d42e532300e954f8bea2f8a64d06da2824
  • libmime
    • https://github.com/nodemailer/libmime/commit/2de24df55b6000f7d319dda42dee4991b086a1b5 (jconv in this time)
    • https://github.com/nodemailer/libmime/commit/aa62a9277f61b7b438c97d1485a5b9ffe7e46840 (jconv is replaced with encoding-japanese)

kenjiuno avatar Nov 28 '20 06:11 kenjiuno

vote

voccer avatar Aug 11 '21 03:08 voccer

vote.

mayurbangar avatar Apr 22 '22 11:04 mayurbangar

vote

kght6123 avatar Dec 22 '22 04:12 kght6123

vote

1shiharat avatar Jan 17 '23 06:01 1shiharat

vote

julianmesa-gitkraken avatar Jan 17 '23 14:01 julianmesa-gitkraken

Vote

FYI: I've ran into same issue and fixed it by importing already mentioned encoding-japanese package.

ntafra00 avatar Jun 30 '23 14:06 ntafra00