Attachement's name encoding fails
<p>I try to send an email with an attachment (A pdf file), but the receiver receives a file with a different name and without the .pdf ending. The name of the file is in Greek.. </p>

<pre><code>try {
    MimeMessage message = new MimeMessage(session);
    message.setFrom(new InternetAddress("from@mail.com"));
    message.setRecipients(Message.RecipientType.TO, InternetAddress.parse(mail));
    message.setSubject(title,"utf-8");

    // Create the message part
    BodyPart messageBodyPart = new MimeBodyPart();

    // Now set the actual message
    messageBodyPart.setText("This is message body");

    // Create a multipar message
    Multipart multipart = new MimeMultipart();

    // Set text message part
    multipart.addBodyPart(messageBodyPart);

    // Part two is attachment
    messageBodyPart = new MimeBodyPart();

    String filename = "file.pdf";
    String f = name + " Πρόγραμμα Ιανουάριος 2016.pdf";  // the desired name of the file
    DataSource source = new FileDataSource(filename);
    messageBodyPart.setDataHandler(new DataHandler(source));
    messageBodyPart.setFileName(MimeUtility.encodeText(f, "UTF-8", null));
    multipart.addBodyPart(messageBodyPart);

    // Send the complete message parts
    message.setContent(multipart);

    Transport.send(message);

    System.out.println("Mail " + mail +" sent");
} catch (MessagingException e) {
    throw new RuntimeException(e);
}
</code></pre>

<p>the <code>name</code> is a string variable and is getting a value previously. The strange is that if I have <code>String f = name + " αααα.pdf"</code> the receiver is getting a pdf succesfully with the name <code>Ρουβάς αααα.pdf</code> but if i have this String <code>f = name + " Πρόγραμμα Ιανουάριος 2016.pdf";</code> he doesn't. He is getting sth like 
<code>=_UTF-8_B_zpzOtc Dz4POsc67zrHPgiDOmc6xzr3Ov8 FzqzPgc65zr_Pgi___ ___filename_1=__5wZGY=_=</code></p>

<p>I added the <code>message.writeTo(System.out);</code> and I got:</p>

<pre><code>MIME-Version: 1.0
Content-Type: multipart/mixed; 
    bou

    ndary="----=_Part_0_1825884453.1457025565509"

    ------=_Part_0_1825884453.1457025565509
    Content-Type: text/plain; charset=us-ascii
    Content-Transfer-Encoding: 7bit

    This is message body
    ------=_Part_0_1825884453.1457025565509
    Content-Type: application/octet-stream; 
        name*0="=?UTF-8?B?zpzOtc+Dz4POsc67zrHPgiDOmc6xzr3Ov8+FzrHPgc6vzr/Pgi"; 
        name*1="Ay?=
     =?UTF-8?B?MDE2zpnOsc69zr/Phc6sz4HOuc6/z4IgMjAxNi5wZGY=?"; 
        name*2="="
    Content-Transfer-Encoding: base64
    Content-Disposition: attachment; 
        filename*0="=?UTF-8?B?zpzOtc+Dz4POsc67zrHPgiDOmc6xzr3Ov8+FzrHPgc6vzr/Pgi"; 
        filename*1="Ay?=
     =?UTF-8?B?MDE2zpnOsc69zr/Phc6sz4HOuc6/z4IgMjAxNi5wZGY=?"; 
        filename*2="="
</code></pre>

<p>with <code>props.setProperty("mail.mime.encodeparameters", "false");</code> or <code>true</code></p>

<pre><code>MIME-Version: 1.0
Content-Type: multipart/mixed; 
    boundary="----=_Part_0_797681969.1457074816557"

------=_Part_0_797681969.1457074816557
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

This is message body
------=_Part_0_797681969.1457074816557
Content-Type: application/octet-stream; name="?????????? 2016.pdf"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; 
    filename*=Cp1252''%3F%3F%3F%3F%3F%3F%3F%3F%3F%3F%202016.pdf
</code></pre>