Home All Groups Group Topic Archive Search About

How can i see my characters

Author
18 May 2006 3:05 PM
basulasz
I get a byte array (byte[]) as a e-mail from pop3 server. I want to see the
Turkish characters like (ş,Ş,ü,Ü, etc.).

When i use
         System.Text.ASCIIEncoding enc = new System.Text.ASCIIEncoding();
          string str = enc.GetString(msg);

i can not see special Turkish characters. So i prefer to use
         System.Text.UnicodeEncoding enc0 = new System.Text.UnicodeEncoding();
         string str0 = enc0.GetString(msg);

but then i only see an array of smal "squares". Then i tried to use,
          System.Text.UTF32Encoding enc2 = new System.Text.UTF32Encoding();
          string str2 = enc2.GetString(msg);

and then i get an emtpy string "str2". I am not sure whether these special
Turkish characters are defined in UTF-32 or not.

How can i get special Turkish charecters?
Thanks a lot.....

Author
19 May 2006 12:00 PM
Göran Andersson
The encoding of the mail body is specified in the mail, either in the
mail header or the multipart section for the body.

If it uses Unicode, it's most likely UTF8.

basulasz wrote:
Show quote
> I get a byte array (byte[]) as a e-mail from pop3 server. I want to see the
> Turkish characters like (ş,Ş,ü,Ü, etc.).
>
> When i use
>          System.Text.ASCIIEncoding enc = new System.Text.ASCIIEncoding();
>           string str = enc.GetString(msg);
>
> i can not see special Turkish characters. So i prefer to use
>          System.Text.UnicodeEncoding enc0 = new System.Text.UnicodeEncoding();
>          string str0 = enc0.GetString(msg);
>
> but then i only see an array of smal "squares". Then i tried to use,
>           System.Text.UTF32Encoding enc2 = new System.Text.UTF32Encoding();
>           string str2 = enc2.GetString(msg);
>
> and then i get an emtpy string "str2". I am not sure whether these special
> Turkish characters are defined in UTF-32 or not.
>
> How can i get special Turkish charecters?
> Thanks a lot.....
Author
20 May 2006 4:11 AM
basulasz
If i change this part of a mail properly, then i see these characters
correctly?

Show quote
"Göran Andersson" wrote:

> The encoding of the mail body is specified in the mail, either in the
> mail header or the multipart section for the body.
>
> If it uses Unicode, it's most likely UTF8.
>
> basulasz wrote:
> > I get a byte array (byte[]) as a e-mail from pop3 server. I want to see the
> > Turkish characters like (ş,Ş,ü,Ü, etc.).
> >
> > When i use
> >          System.Text.ASCIIEncoding enc = new System.Text.ASCIIEncoding();
> >           string str = enc.GetString(msg);
> >
> > i can not see special Turkish characters. So i prefer to use
> >          System.Text.UnicodeEncoding enc0 = new System.Text.UnicodeEncoding();
> >          string str0 = enc0.GetString(msg);
> >
> > but then i only see an array of smal "squares". Then i tried to use,
> >           System.Text.UTF32Encoding enc2 = new System.Text.UTF32Encoding();
> >           string str2 = enc2.GetString(msg);
> >
> > and then i get an emtpy string "str2". I am not sure whether these special
> > Turkish characters are defined in UTF-32 or not.
> >
> > How can i get special Turkish charecters?
> > Thanks a lot.....
>
Author
21 May 2006 5:56 PM
Göran Andersson
No, the other way around. You use the information in the mail to
determine what Encoding you should use to decode the content of the mail.

basulasz wrote:
Show quote
> If i change this part of a mail properly, then i see these characters
> correctly?
>
> "Göran Andersson" wrote:
>
>> The encoding of the mail body is specified in the mail, either in the
>> mail header or the multipart section for the body.
>>
>> If it uses Unicode, it's most likely UTF8.
>>
>> basulasz wrote:
>>> I get a byte array (byte[]) as a e-mail from pop3 server. I want to see the
>>> Turkish characters like (ş,Ş,ü,Ü, etc.).
>>>
>>> When i use
>>>          System.Text.ASCIIEncoding enc = new System.Text.ASCIIEncoding();
>>>           string str = enc.GetString(msg);
>>>
>>> i can not see special Turkish characters. So i prefer to use
>>>          System.Text.UnicodeEncoding enc0 = new System.Text.UnicodeEncoding();
>>>          string str0 = enc0.GetString(msg);
>>>
>>> but then i only see an array of smal "squares". Then i tried to use,
>>>           System.Text.UTF32Encoding enc2 = new System.Text.UTF32Encoding();
>>>           string str2 = enc2.GetString(msg);
>>>
>>> and then i get an emtpy string "str2". I am not sure whether these special
>>> Turkish characters are defined in UTF-32 or not.
>>>
>>> How can i get special Turkish charecters?
>>> Thanks a lot.....

AddThis Social Bookmark Button