Spaces and other characters abort mailto in MRJ for OS X

(Apple Problem IDs # 2826533, 3158812)

     A URL of the form:
mailto:testing@address.xyz?subject=subjectText
creates an e-mail message with the subject text as specified.  This works when done from HTML, but performs improperly under certain circumstances when done from a Java applet using OS 10.x.  There are two sorts of problems:

  1. (3158812) The Safari browser puts up an extra browser window.  To reproduce this type "hello" into the TextField below and press the "Send e-mail" button. This was fixed in Safari 1.0 and Java141DP102.

  2. (2826533) Addresses involving characters requiring URL encoding fail in situations described in the table below:

mailto producer Working example OS 10.1 IE 5.1.3  OS 10.1 NN 6.2 
or Safari 1.0
OS 9 Windows
HTML This link sends mail including a subject OK OK OK OK
Java applet Situation 1 fails
Situation 2 fails
Situation 1 fails
Situation 2 OK
OK OK

Steps to reproduce problem #2
Situation 1:  Type the text between quotes into the subject field and click the button: "one two"
Situation 2:  Type the text between quotes into the subject field and click the button: "one%20two%3a"

Expected results:  
Situation 1:  An e-mail message should pop up with subject "one two"
Situation 2:  An e-mail message should pop up with subject "one two:"

Actual result
Situation 1:  No e-mail message appears.  One might argue that URL encoding is needed but URLEncoder.encode replaces the space by '+', not %20 as desired.  This '+' then appears in the subject line.    
Situation 2:  Using Internet Explorer no e-mail message appears; with Netscape 6.2 this works properly.  This demonstrates the even if one fiddles with URL encoding to replace spaces with %20 instead of '+' some problems still remain.  The problem is not with %3a since "one%3a" works fine, as does "one%20" and "one%20two%22". 

    It appears that there are two separate problems here:

1.  There is no simple way to encode spaces in mailto URLs since URLEncoder.encode does not produce spaces.
2.  Internet Explorer 5.1.3 has a particular problem with some mailto URLs.  This does not appear to be a problem with the semicolon per se since one of the examples that worked fine used a semicolon.

    If you have any insights, workarounds or comments about this test page please contact Mickey Segal.  A listing of  many Macintosh Java bugs with demonstration applets is at this link.

     The source code is shown below and can be downloaded from this link

import java.awt.*;
import java.applet.*;
import java.awt.event.*;
import java.net.*;

public class MailToSubject extends Applet implements ActionListener {

TextField subjectTextField;

public void init()
{
    Label subjectLabel = new Label("Subject:");
    add(subjectLabel);
    add(subjectTextField = new TextField(10));
    Button button;
    add(button = new Button ("Send e-mail"));
    button.addActionListener(this);
}

final void sendMail(String address, String subject)
{
    boolean subjectUsed = !subject.equals("");
    try
    {
        String mailString = "mailto:" + address;
        if (subjectUsed) mailString += "?subject=" + subject;
        getAppletContext().showDocument(new URL(mailString));
    }
    catch (Exception ex) {}
}

public void actionPerformed (ActionEvent e)
{
    sendMail("testing@address.xyz", subjectTextField.getText());
}
} // END OF Class MailToSubject