Click here to Skip to main content
16,020,666 members
Home / Discussions / C#
   

C#

 
QuestionAsync Socket Receive Pin
Richard Andrew x6421-Oct-11 6:48
professionalRichard Andrew x6421-Oct-11 6:48 
AnswerRe: Async Socket Receive Pin
Eddy Vluggen21-Oct-11 9:04
professionalEddy Vluggen21-Oct-11 9:04 
AnswerRe: Async Socket Receive Pin
TheGreatAndPowerfulOz21-Oct-11 9:20
TheGreatAndPowerfulOz21-Oct-11 9:20 
AnswerRe: Async Socket Receive Pin
jschell21-Oct-11 10:59
jschell21-Oct-11 10:59 
GeneralRe: Async Socket Receive Pin
Richard Andrew x6421-Oct-11 11:14
professionalRichard Andrew x6421-Oct-11 11:14 
GeneralRe: Async Socket Receive Pin
jschell21-Oct-11 12:15
jschell21-Oct-11 12:15 
GeneralRe: Async Socket Receive Pin
Richard Andrew x6421-Oct-11 17:55
professionalRichard Andrew x6421-Oct-11 17:55 
QuestionMIME Attachment Names containing Extended Characters Fails Pin
Chadwick Posey21-Oct-11 4:39
Chadwick Posey21-Oct-11 4:39 
Hello all,

While working on a project that emails files with international filenames, I've come across an unusual issue. if I attach with a US-ASCII filename only, I can get better than 200 characters long without errors.

If I include an extended character, it encodes in UTF-8 and the length before it gets funky is very small (< 40 characters). To define funky.. here's an example filename after it goes bad:
=utf-8BSU5GT1JNw4FUSUNBX0ltcGFjdF9Bc3Nl

it looks like UTF8 encoded string with a UTF-8 decoding instruction or a mime boundary... not sure which.

Has anyone seen this before -- and what are the rules / limitations of filenames -- I tried emailing the file by hand through outlook and it handles it, so I don't think it is a MIME specific limitation.

Sample code:
C#
class Program
    {
        private const string DOMAIN = "foobar.com";
        private const string SMTPHOST = "mail." + DOMAIN;
        private const string FROM = "chadwick.posey@" + DOMAIN;
        private const string TO = FROM;

        static void Main(string[] args)
        {
            MailMessage msg = new MailMessage(FROM, TO, "Subject", "Body");
            
            string path = Path.GetTempPath();
            string name = "AAAAAA_AAAAAAAAAAAA_AAAAAAA_AAAA - IIIIIII CCCCCCCCCC DD IIIIIIÁIIII_20111018_091327.pptx";
            
            File.WriteAllText(path + "\\" + name, "blah");
            Attachment att = new Attachment(path + "\\" + name, new ContentType("application/vnd.openxmlformats-officedocument.presentationml.presentation"));

            msg.Attachments.Add(att);

            SmtpClient client = new SmtpClient(SMTPHOST, 25);
            client.Send(msg);
        }
    }


I've tried (so far) -- setting the encoding for the attachment.NameEncoding to UTF8 and UTF32, neither worked. Setting the ContentDisposition.FileName on the attachment fails because it is not using US-ASCII characters only.

Any suggestions on how to get it to include the full filename with the accent / extended characters in tact?

Thanks
Chadwick
=============================
I'm a developer, he's a developer, she's a developer, Wouldn't ya like to be a developer too?

AnswerRe: MIME Attachment Names containing Extended Characters Fails Pin
Eddy Vluggen21-Oct-11 9:13
professionalEddy Vluggen21-Oct-11 9:13 
GeneralRe: MIME Attachment Names containing Extended Characters Fails Pin
Chadwick Posey21-Oct-11 10:17
Chadwick Posey21-Oct-11 10:17 
GeneralRe: MIME Attachment Names containing Extended Characters Fails Pin
Chadwick Posey24-Oct-11 6:28
Chadwick Posey24-Oct-11 6:28 
QuestionSome data gets lost between WCF server and client Pin
teknolog12321-Oct-11 2:06
teknolog12321-Oct-11 2:06 
AnswerRe: Some data gets lost between WCF server and client Pin
OriginalGriff21-Oct-11 2:31
mveOriginalGriff21-Oct-11 2:31 
QuestionRe: Some data gets lost between WCF server and client Pin
Luc Pattyn21-Oct-11 3:14
sitebuilderLuc Pattyn21-Oct-11 3:14 
AnswerRe: Some data gets lost between WCF server and client Pin
OriginalGriff21-Oct-11 3:18
mveOriginalGriff21-Oct-11 3:18 
GeneralRe: Some data gets lost between WCF server and client Pin
Dennis E White21-Oct-11 3:28
professionalDennis E White21-Oct-11 3:28 
GeneralRe: Some data gets lost between WCF server and client Pin
teknolog12321-Oct-11 4:23
teknolog12321-Oct-11 4:23 
AnswerRe: Some data gets lost between WCF server and client Pin
Abhinav S21-Oct-11 2:39
Abhinav S21-Oct-11 2:39 
QuestionHow to make the program do not minimized at all minimized windows? Pin
Slavik_ns20-Oct-11 20:41
Slavik_ns20-Oct-11 20:41 
AnswerRe: How to make the program do not minimized at all minimized windows? Pin
Qendro20-Oct-11 21:01
Qendro20-Oct-11 21:01 
GeneralRe: How to make the program do not minimized at all minimized windows? Pin
Slavik_ns20-Oct-11 21:15
Slavik_ns20-Oct-11 21:15 
AnswerRe: How to make the program do not minimized at all minimized windows? Pin
Eddy Vluggen21-Oct-11 0:41
professionalEddy Vluggen21-Oct-11 0:41 
GeneralRe: How to make the program do not minimized at all minimized windows? Pin
Qendro21-Oct-11 2:16
Qendro21-Oct-11 2:16 
GeneralRe: How to make the program do not minimized at all minimized windows? Pin
BillWoodruff21-Oct-11 17:16
professionalBillWoodruff21-Oct-11 17:16 
AnswerRe: How to make the program do not minimized at all minimized windows? Pin
Eddy Vluggen21-Oct-11 23:18
professionalEddy Vluggen21-Oct-11 23:18 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.