Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Mail attachment charset problem

 
Jeppe Sommer
Ranch Hand
Posts: 270
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

I have made a program which is able to send iCalendar files as an attachment. I get the data as an InputStream.

My problem is that the iCalendar file doesn�t show the letters '�', '�' and '�'. I have tried to use iso-8859-1 in the MimeBodyPart headerline and in the ByteArrayDataSource, but it doesn�t work?!

How do I specify which charset I want to use?

 
Paul Clapham
Sheriff
Posts: 21416
33
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When you say that the iCalendar file doesn't show those characters, exactly what does that mean?

Are you looking at the iCalendar file with a text editor or with an application that understands the iCalendar format?

Does it simply omit those characters, or does it actually replace them with something else? If so, what?
 
Jeppe Sommer
Ranch Hand
Posts: 270
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Paul Clapham:
When you say that the iCalendar file doesn't show those characters, exactly what does that mean?

When I open the ICalendar file using a text editor these special letters are replaced, i.e.:

This is the original text:
This is the description text l�l�l�

- is replaced with:
DESCRIPTION;CHARSET=ISO-8859-1:This is the description text l?l?l?

and this original text:
The meeting name using the word m�de

- is replaced with:
SUMMARY;CHARSET=ISO-8859-1:The meeting name using the word m?de

Are you looking at the iCalendar file with a text editor or with an application that understands the iCalendar format?

Both. When open the Ical file with a text editor the letters isn�t shown correct. When open the file usin Outlook the letters isn�t shown correct.

Does it simply omit those characters, or does it actually replace them with something else? If so, what?

The letters are replaced with '?'

[ May 10, 2007: Message edited by: Jeppe Fjord ]
[ May 10, 2007: Message edited by: Jeppe Fjord ]
 
Jeppe Sommer
Ranch Hand
Posts: 270
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I removed the line:
>mbp3.addHeaderLine("charset=iso-8859-1");

- and now the letters are shown correct when opening the ICalendar file using a text editor.

But when openning the file using Outlook the letters '�', '�', '�' are removed?! I know that isn�t a problem in my mail code but certainly in the iCal file?!
 
Paul Clapham
Sheriff
Posts: 21416
33
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For what it's worth, RFC2445 says this:
NON-US-ASCII = %x80-F8
; Use restricted by charset parameter
; on outer MIME object (UTF-8 preferred)
It also says this:
There is not a property parameter to declare the character set used
in a property value. The default character set for an iCalendar
object is UTF-8 as defined in [RFC 2279].
So it seems that the CHARSET part of "DESCRIPTION;CHARSET=ISO-8859-1:..." is not valid. But I would try using the UTF-8 encoding instead of ISO-8859-1.

If all else fails, use Outlook to generate an iCalendar file and see how it does it.
 
Jeppe Sommer
Ranch Hand
Posts: 270
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Paul Clapham:
For what it's worth, RFC2445 says this: So it seems that the CHARSET part of "DESCRIPTION;CHARSET=ISO-8859-1:..." is not valid. But I would try using the UTF-8 encoding instead of ISO-8859-1.

If all else fails, use Outlook to generate an iCalendar file and see how it does it.


Alright so far so good... I removed the charset part ";CHARSET=ISO-8859-1:..." from my ICalendar file.

In my code I changed the code to use utf-8 (I also tried to remove the charset part):

The result is the same - the letters aren�t shown when opening the ICalender file using Outlook. So I saved an event file made by Outlook in the ICalendar format:

The original text:
M�de M�de m�de

- is shown like this saving the file with Outlook:
SUMMARY:M��de M��de m��de

I am confused?! I have read an article about some guys debating the same problem, but I don�t get the point how to solve it?!

http://www.dotnet247.com/247reference/msgs/43/217592.aspx
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic