ISO decoding in email subject

Found a serious/minor bug in PopTray? Tell me about it.

Moderators: KY Dave, jojobear99, Rdsok

Locked
User avatar
vitoco
Veteran
Posts: 422
Joined: Wed Jul 09, 2003 9:22 pm
Location: Chile
Contact:

ISO decoding in email subject

Post by vitoco » Wed Oct 22, 2003 10:45 pm

I was notified by PT for a mail with the subject:
Dirección Invitación Ceremonia Graduación

It had accents, so it was encoded as:
Subject: =?iso-8859-1?Q?Direcci=F3n=20Invitaci=F3n?= Ceremonia =?iso-8859-1?Q?Graduaci=F3n?=

I replied that mail using IMP (webmail). I sent a cc to myself to archive my reply at home, and the subject was recoded to:
Subject: =?ISO-8859-1?B?UmU6IERpcmVjY2nzbg==?==?ISO-8859-1?B?IEludml0YWNp824gQw==?==?ISO-8859-1?B?ZXJlbW9uaWEgR3JhZHVhY2nzbg==?=
which PT displayed as:
Re: DirecciónRe: Dirección Invitación CRe: Dirección Invitación Ceremonia Graduación

Was this an Indy bug?

++V

User avatar
Renier
Site Admin
Posts: 1956
Joined: Mon Oct 15, 2001 12:54 pm
Location: Cape Town, South-Africa
Contact:

Post by Renier » Thu Oct 23, 2003 9:25 am

All the charset decoding is done by Indy, so I don't know anymore about how it is done. Maybe the next version of PopTray I'll upgrade to a newer version of Indy, and hopefully some bugs will be fixed.

jtisdall
First Timer
Posts: 1
Joined: Thu Nov 06, 2003 3:45 pm
Location: Norway

Post by jtisdall » Thu Nov 06, 2003 3:47 pm

I have this same problem with the latest version, with Scandinavian characters (åøæ), and not just in the subject - everywhere.

jt

User avatar
jojobear99
PopTrayU Developer
Posts: 56
Joined: Thu May 17, 2007 9:10 pm

Suggestion of start of how to implement this request

Post by jojobear99 » Tue Aug 19, 2008 11:12 pm

Renier,
I have taken a look at the source code for PopTray and the RFC spec on email headers, and I believe the subject encoding problem is one that could easily be resolved without waiting for Indy components to do character set conversion. (I don't actually have a Delphi compiler set up to write and test a patch, but here's an outline of the proposal for a solution I've come up with so far:

In uMain.pas, there is a procedure ShowMailMessage(...). In particular, on line 1295, there is a line:
SubItems.Add(Accounts[num-1].Mail.Subject);
I believe at this point you need to "translate" the subject. The subject is interpreted by the Indy components as Ansi, which is correct based on the email header RFC. However, there's some stuff that was added as an after-thought for how to accomodate international subjects in headers that only ascii is allowed in. So we can "undo" or fix the subject line at this point.
Maybe that line becomes:
SubItems.Add(FixEncoding(Accounts[num-1].Mail.Subject));
and you add a new procedure FixEncoding(subject:string) : string
that will "fix" the subject encoding into something more human readable.

According to the RFC, the format for specifying a non-ansi subject is:
"=?" charset "?" encoding "?" encoded-text "?="
This should be simple enough format to tokenize using standard string tokenizing libraries. if the string does not follow this pattern, return the string as is. Otherwise, we have to process it and fix its encoding.

Encoding is either "Q" for Quoted-Printable or "B" for Base64. Those are the only two options, so not too complicated there, other than locating or creating a library function to decode those two encodings. Base64 allows for longer subjects with foriegn characters, but its not human readable, whereas quoted printable only changes spaces and non-ascii characters using escape codes. I haven't researched this yet, but I would imagine a library or example code for how to decode Base64 and Quoted-Printable back to "normal text" is not difficult to find.

Charset slightly more complicated, in that there's a larger list of choices that are possible. I don't know how good Delphi's built in support for doing charset conversion is, I've only done them in C++ and Java. In C++ everything had to be converted to Unicode instead of UTF-8 and displayed as "wide strings" which is a little weird at first, but doable, though it required a few format strings with %S conversions to change from ansi-unicode and vice versa. In Java its as simple as passing the string and a string with its encoding to a special library function and it auto-magically swaps the encoding. But if its particularly complicated, even just adding support for the most common one, UTF-8, would very much benefit users of pop-tray. UTF-8 to Unicode is a relatively simple conversion even if you have to code it manully. Getting the list component to display wide strings rather than ansi strings may be automatic, or might require a minor change somewhere, not sure.

Anyway, I hope that is helpful! I'd be happy to discuss implementing this feature farther or do some more research if one of these steps turns out to be a hang-up...its a feature I'd very much like to see!

Tahtu
Still here
Posts: 14
Joined: Wed May 28, 2008 1:03 pm

Post by Tahtu » Fri Nov 14, 2008 2:12 pm

I developed PopTray further more - with Unicode Support, HTML Preview and better Attachment handlings.

Unfortunately Renier is not interessed to publish my developement - nor he is interessed to update PopTray by hisself. It's up to you to please him do develope by himself or to publish my work.

User avatar
Rdsok
PopTray Family
Posts: 1350
Joined: Fri Mar 19, 2004 11:36 pm
Location: Norman, Oklahoma USA
Contact:

Post by Rdsok » Sat Nov 15, 2008 2:46 am

Tahtu,

Why don't you do as you were told concerning this issue long ago and publish a variant as you were suggested many, many times now.... Renier shouldn't be expected to publish yours ... Quit acting childish and and either publish a variant ( with a unique name so users can tell the difference ) or just shut up.
Renier wrote:OK, I'll answer here.

I've been considering Tahtu's suggestion for a while now. I know I haven't been able to work on PopTray for a long time now.

The problem with Tahtu's version though is that it uses a commercial library (which basically means it isn't licensable under GPL anymore, and people won't be able to compile it without buying that library).

There are also a few features from normal PopTray removed (customization etc).

Tahtu
Still here
Posts: 14
Joined: Wed May 28, 2008 1:03 pm

Post by Tahtu » Sat Nov 15, 2008 9:43 am

Rdsok wrote:Why don't you do as you were told concerning this issue long ago and publish a variant as you were suggested many, many times now.... Renier shouldn't be expected to publish yours ... Quit acting childish and and either publish a variant ( with a unique name so users can tell the difference ) or just shut up.
I think all you can do is writing words - but are you able to assist users with new features? If not, why don't you just shut up?

A lot of users are interessed to get the new features - why don't you please Renier to offer an update with that feature? Indeed it's up to Reniere to decide how to do this - but doing nothing is really not what the users interessed.

Are you able to see, that your posings are destructive and bothering for the users?

User avatar
Rdsok
PopTray Family
Posts: 1350
Joined: Fri Mar 19, 2004 11:36 pm
Location: Norman, Oklahoma USA
Contact:

Post by Rdsok » Sat Nov 15, 2008 9:51 am

Apparently you are childish or just a troll trying to stir up non-issues.

Tahtu
Still here
Posts: 14
Joined: Wed May 28, 2008 1:03 pm

Post by Tahtu » Sat Nov 15, 2008 10:06 am

... so what is the differnce between you and me?

What do you do to help users to find an update of PopTray with Unicode support and HTML preview?

Do you really think users are interessed that you try to block and flame me?

... so, but you postings are not helpfull for other users in this case. So please assist users to get a Unicode version or just troll yourself away from this forum!

I'm sorry, but in this case your absolutely not helpfull for other people - all you do this showing yourself you would be the greatest. Showing that is easy, but users are interessed to get updates - and you are not able to offering that. So you are just a young child who are trying to show other one to be the biggest. REALYY childish from you!


Being destructive is allways the easiest way to change a lot of thing - but it's never helpfull for anything else than the own egoithm. So please stop your childish destructive postings to assist other people.

User avatar
Rdsok
PopTray Family
Posts: 1350
Joined: Fri Mar 19, 2004 11:36 pm
Location: Norman, Oklahoma USA
Contact:

Post by Rdsok » Sat Nov 15, 2008 10:41 am

I actually do help others in the areas that I can... but you are correct that programming isn't one of them... Instead I help others more on the system and hardware levels instead of the programming. So me not assisting in programming doesn't mean I don't assist in other areas or that I do not know what I'm talking about as you seem to want to imply to everyone.

You talk about your programming.. but you won't publish it was as suggested to you by others... What are you afraid of if you won't publish your own work?... Instead your posts condemn others and Renier for not publishing what you did for you so you don't have to deal with those details ( the publishing and licensing issues )...

Renier has already looked at your coding.. and considered the libraries it required and has stated why he can't use it since the licensing for the library code you used wouldn't allow the GPL licensing which he believes in... Why can't you just accept that he can't support your version for the reasons he stated?

It is also just your posting your displeasure with the decision that Renier had felt was needed in every thread that you can... that I even responded to your posts.

I am only pointing out to all of the other readers that what you are trying to imply isn't the complete information and is in fact misleading as to why your program version wasn't being supported or promoted by Renier. It is for that fact, that I pointed out the whole story which includes Renier response, that you are now evening trying to discredit myself.

User avatar
Renier
Site Admin
Posts: 1956
Joined: Mon Oct 15, 2001 12:54 pm
Location: Cape Town, South-Africa
Contact:

Post by Renier » Mon Nov 17, 2008 9:00 am

Rdsok, thank you very much for your support on this forum. I am amazed that users like you and vitoco are still hanging around here for the last 4 to 5 years, willing to help people.

Tahtu, I am not going to publish your work, that is my decision. I can see you don't like that decision, but it is still mine to make.

In fact now that I've thought about it again, your version might actually break the rules of the GPL and may not be published at all. If I understand the GPL correctly any derivative work has to be open-source too, and with the closed library yours is using, I don't think it can be deemed open-source anymore.

Locked

Who is online

Users browsing this forum: No registered users and 3 guests