ditesh / node-poplib

POP3 client library for Node.js
MIT License
128 stars 44 forks source link

ASCII vs. UTF8 #18

Open Sjonnie2nd opened 9 years ago

Sjonnie2nd commented 9 years ago

Hi Ditesh,

This does not look to be an issue of poplib persé, but maybe it wel help others.

Running poplib in node.js on Windows 7, i received some emails which were unreadable (even the headers). More unluckely, in some cases the retr command got stuck (no retr event was fired).

After the retr command the log for example starts with: "+OK \u0000\u0000\u0000\u0000 oct\u0000". Sometimes ending with a "\r\n.\r\n", sometimes not.

But hey! Why did my old .NET C# POP3-client not have this issue. Looking at the source I saw that (by accident) every communication with the server was translated to UTF-8!

Cause of all this looks to be the Dovecot server of the provider which unattendedly sends UTF-8 formatted lines (but I'm not sure). I've seen POP3 recently has a UTF-8 capability (RFC 6856), but on CAPA the server doesn't return UTF-8 as a capability.

My simple workarround: Changed line 201 of main.js: data = data.toString("ascii"); into: data = data.toString("utf8"); Looks to work without problems.

Any thoughts? Greetings.

Rossonero commented 9 years ago

i got the same problem as well and i did the same change to solve it.