Closed Bug 63656 Opened 24 years ago Closed 23 years ago

Mozilla should recognize RFC2231 enconding of filename parameter

Categories

(MailNews Core :: Internationalization, defect)

defect
Not set
major

Tracking

(Not tracked)

RESOLVED WORKSFORME

People

(Reporter: m_kato, Assigned: nhottanscp)

References

()

Details

(Keywords: intl)

Attachments

(3 files)

The filename parameter of Content-Disposition must uses RFC2231.
But Mozilla cannot corrently recognize filename parameter which uses RFC2231.
Attached file sample mail
Attached patch patchSplinter Review
Adding RFE and patch keyword. Marking NEW, so someone will decide if this is a
good idea or not.
Status: UNCONFIRMED → NEW
Ever confirmed: true
Keywords: patch
Summary: Mozilla should recognize RFC2231 enconding of filename parameter → [RFE] Mozilla should recognize RFC2231 enconding of filename parameter
You need to get a review by rhp for the patch.

I have a couple questions. You changed to support parameter continuation but the
patch does not have the code to unfold continuations. Has that already existed
in mozilla?
The patch does not do the decoding and instead converts from UTF-8 to specified
charset. Does that mean the decoding and the unfolding are done somewhere else
already?

Remove RFE and reassign to Kato san, please get r=/sr= and check in.
Assignee: nhotta → m_kato
Keywords: intl
Summary: [RFE] Mozilla should recognize RFC2231 enconding of filename parameter → Mozilla should recognize RFC2231 enconding of filename parameter
Can you tell us if your patch covers/parses the following
items in RFC 2231?

1. Encoding name
2. Language name
3. Lightweight encoding used in RFC 2231

I don't know if we use Language name info right now
but potentially it may be used to set fonts correctly
in some cases.
Momoi-san,
Langauge paramter does not watch since Mozilla uses Unicode/UTF-8 only by 
internal.  And font should not set since filename is not releted to font.
Status: NEW → ASSIGNED
Kato-san,

Language name is optional and I don't think we should be
paying attention to it. So, yes, as long as we parse it
and ignore it, that is OK with me.

By the way, Keyser raised an issue if this is a good
thing. It is a good thing to implement because this
is the only acceptable way of transmitting non-ASCII
filenames.
QA contact to ji.
QA Contact: momoi → ji
I forgot the answer for hotta-san.

> I have a couple questions. You changed to support parameter continuation
> but the patch does not have the code to unfold continuations. Has that
> already existed in mozilla?

RFC2231 encoding is already implemented.  But this isn't used for filename 
parameter.  Probably, netscape engineeers don't understand abount encoding of 
filename parameter of Content-Disposition.  I told keith (the author of RFC).

> The patch does not do the decoding and instead converts from UTF-8 to
> specified charset. Does that mean the decoding and the unfolding are
> done somewhere else already?

mime_decode_filename() function decodes from RFC2047's encoding to UTF-8.
So I converted to UTF-8.

Okay, please get this reviewed by rhp or ducarroz.
rhp, can you review??
FYI, I am replacing rhp now.

Instead of doing the following pattern 4 time:
+          if (charset)
+          {
+            // this is seem to be a mail which supports RFC2231.
+            MIME_ConvertString(charset, "UTF-8", tmp->real_name, &fname);
+            PR_Free(charset);
+            charset = nsnull;
+          }
+          else
+            fname = mime_decode_filename(tmp->real_name);

Can you pass the charset to mime_decode_filename() and change this function do
the right job. Something like:

...
fname = mime_decode_filename(tmp->real_name, charset);
PR_FREEIF(charset);
...

Thanks

ducarroz, could you review?
Twice you do:
+        PR_FREEIF(charset);
+        charset = nsnull;
as the macro PR_FREEIF will set the variable to 0, you don't need to do it
yourself. Appart that, R=ducarroz
you could use an XPIDLCString for the charset, along with getter_Copies - then
you wouldn't need to put the PR_FREEIF's in at all. If you do that, or
ducarroz's suggestion, then sr=bienvenu
check in
Status: ASSIGNED → RESOLVED
Closed: 24 years ago
Resolution: --- → FIXED
This fix was designed poorly.  Had I been asked, I would have refused an r=.

The conversion to UTF-8 should be done in MimeHeaders_get_parameter().  It 
should not be the responsibility of every single caller to 
MimeHeaders_get_parameter(). The "charset" parameter of 
MimeHeaders_get_parameter() should be removed.
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Do you mean the following change?

char *
MimeHeaders_get_parameter (const char *header_value, const char *parm_name, 
                           char **charset, char **language)
 ->

char *
MimeHeaders_get_parameter (const char *header_value, const char *parm_name, 
                           char **language)

Status: REOPENED → ASSIGNED
Reassign to nhotta.

Does this still happen?
Assignee: m_kato → nhotta
Status: ASSIGNED → NEW
This problem doesn't exist on 04/08 trunk build.
Marked it wfm. Kato, please feel free to reopen it if you still see this problem.
Status: NEW → RESOLVED
Closed: 24 years ago23 years ago
Resolution: --- → WORKSFORME
Product: MailNews → Core
Product: Core → MailNews Core
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: