简体   繁体   中英

Support multilingual characters in .ics file

I am using c# to generate .ics file . I am able to send calendar invite as attachement through mail. But the invite does not support multi-lingual characters.

How can I enable support for multi-lingual characters?

StringBuilder CalenderInviteString = new StringBuilder();

            CalenderInviteString.AppendLine("BEGIN:VCALENDAR");
            CalenderInviteString.AppendLine("PRODID:-//Invite");
            CalenderInviteString.AppendLine("VERSION:2.0");
            CalenderInviteString.AppendLine(string.Format("X-WR-RELCALID:{0}",invite.Id));
            CalenderInviteString.AppendLine(string.Format("METHOD:{0}",(invite.Method==CalendarMethod.UPDATE)?"REQUEST":invite.Method.ToString()));
            CalenderInviteString.AppendLine("BEGIN:VEVENT");
            CalenderInviteString.AppendLine(string.Format("DTSTART:{0:yyyyMMddTHHmmssZ}", invite.StartDate));
            CalenderInviteString.AppendLine(string.Format("DTSTAMP:{0:yyyyMMddTHHmmssZ}", invite.DateTimeStamp));
            CalenderInviteString.AppendLine(string.Format("DTEND:{0:yyyyMMddTHHmmssZ}", invite.EndDate));
            CalenderInviteString.AppendLine(string.Format("LOCATION: {0}", invite.Location));
            CalenderInviteString.AppendLine(string.Format("UID:{0}", invite.Id));
            CalenderInviteString.AppendLine("SEQUENCE:1");
            CalenderInviteString.AppendLine(string.Format("STATUS:{0}", invite.Status.ToString()));
            CalenderInviteString.AppendLine(string.Format("DESCRIPTION:{0}", invite.Description));
            CalenderInviteString.AppendLine(string.Format("X-ALT-DESC;FMTTYPE=text/html:{0}", invite.Content));
            CalenderInviteString.AppendLine(string.Format("SUMMARY:{0}", invite.Summary));
            CalenderInviteString.AppendLine(string.Format("ORGANIZER:MAILTO:{0}",invite.Organizer));



        CalenderInviteString.AppendLine("BEGIN:VALARM");
        CalenderInviteString.AppendLine("TRIGGER:-PT15M");
        CalenderInviteString.AppendLine("ACTION:DISPLAY");
        CalenderInviteString.AppendLine("DESCRIPTION:Reminder");
        CalenderInviteString.AppendLine("END:VALARM");
        CalenderInviteString.AppendLine("END:VEVENT");
        CalenderInviteString.AppendLine("END:VCALENDAR");

        return CalenderInviteString.ToString();

Use a Content-Type (mime type) with an appropriate charset.

Example:

text/calendar; charset=gb18030

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM