You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@openoffice.apache.org by bu...@apache.org on 2012/01/16 08:32:13 UTC

DO NOT REPLY [Bug 118791] New: XMailMessage attachment unusable if file name (ReadableName) contains non-ASCII characters

https://issues.apache.org/ooo/show_bug.cgi?id=118791

             Bug #: 118791
        Issue Type: DEFECT
           Summary: XMailMessage attachment unusable if file name
                    (ReadableName) contains non-ASCII characters
    Classification: Code
           Product: api
           Version: version58
          Platform: PC
        OS/Version: Windows XP
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P5
         Component: definition
        AssignedTo: tbo@openoffice.org
        ReportedBy: donjaime@freenet.de
                CC: ooo-issues@incubator.apache.org


Created attachment 77134
  --> https://issues.apache.org/ooo/attachment.cgi?id=77134
Test file sends two messages, one with attachment "Confirmation", one with
attachment "Bestätigung"

If XMailServer is used to send an XMailMessage with an attachment whose
ReadableName contains non-ASCII character, the attachment header is garbled and
the attachment cannot be extracted. For example: if the attachment name is
"Bestätigung", the Content-Disposition header is rendered as:

Content-Disposition: =?utf-8?q?attachment=3B_filename=3D=22Best=C3=A4tigung?=
    =?utf-8?q?=22?=

while with file name "Confirmation", the header is:

Content-Disposition: attachment; filename="Confirmation"

Presumably the problem is something simple like "encode(foo & bar)" instead of
"foo & encode(bar)"

-- 
Configure bugmail: https://issues.apache.org/ooo/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

DO NOT REPLY [Bug 118791] XMailMessage attachment unusable if file name (ReadableName) contains non-ASCII characters

Posted by bu...@apache.org.
https://issues.apache.org/ooo/show_bug.cgi?id=118791

--- Comment #9 from Ariel Constenla-Haile <ar...@apache.org> 2012-01-25 11:25:56 UTC ---
Created attachment 77166
  --> https://issues.apache.org/ooo/attachment.cgi?id=77166
Localized mail attachments readable name UTF-8 encoded - Thunderbird client -
WinXP

-- 
Configure bugmail: https://issues.apache.org/ooo/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

DO NOT REPLY [Bug 118791] XMailMessage attachment unusable if file name (ReadableName) contains non-ASCII characters

Posted by bu...@apache.org.
https://issues.apache.org/ooo/show_bug.cgi?id=118791

--- Comment #3 from Ariel Constenla-Haile <ar...@apache.org> 2012-01-16 12:26:52 UTC ---
@DonJaime: please replace 

${ROOT_INST_DIR}/openoffice.org/basis3.${MINOR}/program/mailmerge.py

with the one attached in this bug (first back-up the original one).

The fix to this issue is encoding the ReadableName to utf-8:

msgattachment.add_header(\
'Content-Disposition', \
'attachment', \
filename=('utf-8','',attachment.ReadableName.encode('utf-8')))

-- 
Configure bugmail: https://issues.apache.org/ooo/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

DO NOT REPLY [Bug 118791] XMailMessage attachment unusable if file name (ReadableName) contains non-ASCII characters

Posted by bu...@apache.org.
https://issues.apache.org/ooo/show_bug.cgi?id=118791

--- Comment #10 from Ariel Constenla-Haile <ar...@apache.org> 2012-01-25 11:44:39 UTC ---
(In reply to comment #7)
> Revision 118791
> Encode ReadableName in UTF-8 only when necessary

I meant revision 1235677

-- 
Configure bugmail: https://issues.apache.org/ooo/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

DO NOT REPLY [Bug 118791] XMailMessage attachment unusable if file name (ReadableName) contains non-ASCII characters

Posted by bu...@apache.org.
https://issues.apache.org/ooo/show_bug.cgi?id=118791

--- Comment #7 from Ariel Constenla-Haile <ar...@apache.org> 2012-01-25 11:23:48 UTC ---
Revision 118791
Encode ReadableName in UTF-8 only when necessary

-- 
Configure bugmail: https://issues.apache.org/ooo/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

DO NOT REPLY [Bug 118791] XMailMessage attachment unusable if file name (ReadableName) contains non-ASCII characters

Posted by bu...@apache.org.
https://issues.apache.org/ooo/show_bug.cgi?id=118791

--- Comment #8 from Ariel Constenla-Haile <ar...@apache.org> 2012-01-25 11:25:21 UTC ---
Created attachment 77165
  --> https://issues.apache.org/ooo/attachment.cgi?id=77165
Localized mail attachments readable name UTF-8 encoded - Mutt client - Linux

-- 
Configure bugmail: https://issues.apache.org/ooo/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

DO NOT REPLY [Bug 118791] XMailMessage attachment unusable if file name (ReadableName) contains non-ASCII characters

Posted by bu...@apache.org.
https://issues.apache.org/ooo/show_bug.cgi?id=118791

--- Comment #2 from Ariel Constenla-Haile <ar...@apache.org> 2012-01-16 12:21:18 UTC ---
Created attachment 77136
  --> https://issues.apache.org/ooo/attachment.cgi?id=77136
mailmerge.py with some fixes

-- 
Configure bugmail: https://issues.apache.org/ooo/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

DO NOT REPLY [Bug 118791] XMailMessage attachment unusable if file name (ReadableName) contains non-ASCII characters

Posted by bu...@apache.org.
https://issues.apache.org/ooo/show_bug.cgi?id=118791

Ariel Constenla-Haile <ar...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|STARTED                     |RESOLVED
         Resolution|                            |FIXED

-- 
Configure bugmail: https://issues.apache.org/ooo/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

DO NOT REPLY [Bug 118791] XMailMessage attachment unusable if file name (ReadableName) contains non-ASCII characters

Posted by bu...@apache.org.
https://issues.apache.org/ooo/show_bug.cgi?id=118791

DonJaime <do...@freenet.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Platform|All                         |PC
         OS/Version|All                         |Windows XP

--- Comment #4 from DonJaime <do...@freenet.de> 2012-01-16 13:55:09 UTC ---
Replaced as instructed. I had to edit line 46 to dbg = False because the ascii
codec was choking on line 128, and when that was fixed I got:

An exception occurred 
Type: com.sun.star.uno.RuntimeException
Message: <type 'exceptions.RuntimeError'>: No SSL support included in this
Python, traceback follows
  C:\Program Files\OpenOffice.org
3\Basis\program\python-core-2.6.1\lib\smtplib.py:615 in function starttls()
[raise RuntimeError("No SSL support included in this Python")]
  C:\Program Files\OpenOffice.org 3\Basis\program\mailmerge.py:88 in function
connect() [self.server.starttls()]
.

So I used ConnectionType Insecure and then it worked.

-- 
Configure bugmail: https://issues.apache.org/ooo/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

DO NOT REPLY [Bug 118791] XMailMessage attachment unusable if file name (ReadableName) contains non-ASCII characters

Posted by bu...@apache.org.
https://issues.apache.org/ooo/show_bug.cgi?id=118791

Ariel Constenla-Haile <ar...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |STARTED
                 CC|                            |arielch@apache.org
           Platform|PC                          |All
         AssignedTo|tbo@openoffice.org          |arielch@apache.org
     Ever Confirmed|0                           |1
         OS/Version|Windows XP                  |All
           Severity|enhancement                 |normal

--- Comment #1 from Ariel Constenla-Haile <ar...@apache.org> 2012-01-16 12:19:29 UTC ---
According to
http://docs.python.org/library/email.message.html?highlight=add_header#email.message.Message.add_header

For each item in the keyword argument dictionary _params, the key is taken as
the parameter name, with underscores converted to dashes (since dashes are
illegal in Python identifiers). Normally, the parameter will be added as
key="value" unless the value is None, in which case only the key will be added.
If the value contains non-ASCII characters, it must be specified as a three
tuple in the format (CHARSET, LANGUAGE, VALUE), where CHARSET is a string
naming the charset to be used to encode the value, LANGUAGE can usually be set
to None or the empty string (see RFC 2231 for other possibilities), and VALUE
is the string value containing non-ASCII code points.

An example with non-ASCII characters:

msg.add_header('Content-Disposition', 'attachment',
               filename=('iso-8859-1', '', 'Fußballer.ppt'))

Which produces

Content-Disposition: attachment; filename*="iso-8859-1''Fu%DFballer.ppt"

-- 
Configure bugmail: https://issues.apache.org/ooo/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

DO NOT REPLY [Bug 118791] XMailMessage attachment unusable if file name (ReadableName) contains non-ASCII characters

Posted by bu...@apache.org.
https://issues.apache.org/ooo/show_bug.cgi?id=118791

Ariel Constenla-Haile <ar...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Platform|PC                          |All
            Version|version58                   |current
         OS/Version|Windows XP                  |All

--- Comment #5 from Ariel Constenla-Haile <ar...@apache.org> 2012-01-17 02:29:18 UTC ---
Fixed in revision 1232130

-- 
Configure bugmail: https://issues.apache.org/ooo/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

DO NOT REPLY [Bug 118791] XMailMessage attachment unusable if file name (ReadableName) contains non-ASCII characters

Posted by bu...@apache.org.
https://issues.apache.org/ooo/show_bug.cgi?id=118791

--- Comment #6 from Ariel Constenla-Haile <ar...@apache.org> 2012-01-17 02:36:07 UTC ---
(In reply to comment #4)
> Replaced as instructed. I had to edit line 46 to dbg = False because the ascii
> codec was choking on line 128, and when that was fixed I got:
> 
> An exception occurred 
> Type: com.sun.star.uno.RuntimeException
> Message: <type 'exceptions.RuntimeError'>: No SSL support included in this
> Python, traceback follows
>   C:\Program Files\OpenOffice.org
> 3\Basis\program\python-core-2.6.1\lib\smtplib.py:615 in function starttls()
> [raise RuntimeError("No SSL support included in this Python")]
>   C:\Program Files\OpenOffice.org 3\Basis\program\mailmerge.py:88 in function
> connect() [self.server.starttls()]
> .
> 
> So I used ConnectionType Insecure and then it worked.

yes, this was bug 118787 that made you use insecure connection when specifying
"SSL". It compared"Ssl" != "SSL" in a case sensitive way; as these string are
not equal, it used an insecure connection.

This seem to have worked for you (your smtp server seems to use insecure
connection), but didn't work with Gmail's smtp server for example.

-- 
Configure bugmail: https://issues.apache.org/ooo/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.