Problem with incoming email character in Frappe/ERPNext

I have configured email account for incoming email to create document. And most of the document created is OK, but for some email, the character messed up.

�BDI : ��Ǩ�ͺ�Է�������� AA : Project �ͧ ��. ����

=E0=C3=D5=C2=B9=B7=D5=C1 ecosoft

=C1=D5=E0=A4=CA =BC=CD. =BD= =E8=D2=C2=E0=CB=E7=B9 AA =A2=CD=A7=E2=A4=C3=A7=A1=D2=C3=B7=D5=E8=B5=D1=C7= =E0=CD=A7=E4=C1=E8=E4=B4=E9=CD=C2=D9=E8=A4=C3=D1=BA

=A4=D8=B3=B4=C7=A7=E3=A8 =E0=BB=E7=B9 =BC=CD. =BD=E8=D2=C2=BE=D1=B2=B9=D2= =A1=D3=C5=D1=A7=A4=B9
=E0=CB=E7=B9 Project P670203 =E3= =B9=B0=D2=B9=D0 member ( =CD=D1=B9=B9=D5=E9=B6=D9=A1=E1=C5=E9=C7)
=E1=B5=E8=B5=E9=CD=A7=E4=C1=E8=E0=CB=E7= =B9 Project P670202 =E1=C5=D0 Project P670106
=E0=BE=C3=D2=D0 P670202 =CB=D1=C7=CB=B9= =E9=D2=E2=A4=C3=A7=A1=D2=C3=CD=C2=D9=E8=BD=E8=D2=C2=BA=C3=D4=A1=D2=C3=C7=D4=

Anyone face the same issue? And what can we do about it?

I found the problem and propose the fix here,

It is because the incoming email is using charset window-874 which python don’t know about. So, need to change to cp874 when do the decoding.