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

Can't analysis Chinese #25

Closed
zhangxinagjunHJH opened this issue Aug 4, 2020 · 4 comments
Closed

Can't analysis Chinese #25

zhangxinagjunHJH opened this issue Aug 4, 2020 · 4 comments

Comments

@zhangxinagjunHJH
Copy link

Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

Describe the solution you'd like
A clear and concise description of what you want to happen.

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Additional context
Add any other context or screenshots about the feature request here.

@michaelspiss
Copy link
Owner

Hi, please provide more information.

What are you trying to do?
How are you trying to do it?
What happens?
What does the log say?

Thanks

@zhangxinagjunHJH
Copy link
Author

zhangxinagjunHJH commented Aug 5, 2020

@michaelspiss Thank you for your reply so quickly. I found one problem if the email content contains Chinese fields, it will give this words, such as "Department":"=E6=9C=AC=E5=8D=95=E4=BD=8D". Then I checked the email in my Imap account, it's correct, it shows "Department":"本单位".
So I think these are the problems of decoding Chinese fields?

@michaelspiss
Copy link
Owner

"=E6=9C=AC=E5=8D=95=E4=BD=8D" is the encoded representation of "本单位", as imap (without utf8 extension) only works with us-ascii characters. So this is actually working as expected. This package does not include a mime parser which would convert it back to human-readable format.

Decoding "quoted printable" encoded strings basically works by splitting the string at each = and then treating all substrings as hexadecimals. They can be converted into integers with int.parse("0x$hex"); (hex being the variable holding a substring). Put all (now) decimals into an array and decode it using utf8.decode(array_of_integers);. This gives you the string in readable form.

@zhangxinagjunHJH
Copy link
Author

@michaelspiss Yes, I checked the encode format, then converted it to readable format.

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

2 participants