Click here to Skip to main content
Click here to Skip to main content

Decoding the "Windows 1255" format

By , 11 May 2009
 

Decode Method

Introduction

This article solves the problem of decoding the Windows 1255 encoding.

Background

Usually, when you get Hebrew emails, the subject line is encoded in a strange way. After reading a lot of articles on the subject, I decided to rollout a decoding version of my own, which handles Base64 and plain encoding of Hebrew messages.

Using the Code

Instantiate the class with the text to decode, and use the Decode method. The static property IsWindows1255 can determine if the text is actually encoded to avoid the exception thrown by the constructor (when given a non-encoded text).

Like this:

if (Windows1255Helpers.IsWindows1255(ret))
{
    Windows1255Helpers helper = new Windows1255Helpers(ret);
    ret = helper.Decode();
}

If you have further questions, don't hesitate to send a mail. And furthermore, you can visit me (and my friends!) at our blog.

Points of Interest

I have read some specifications regarding encoding or decoding of MIME messages and subjects, and if I have missed something, please feel free to remark.

And please excuse my English if there are mistakes; I'm from Israel, and English is not my primary language.... :)

History

  • First version - 11.5.2009.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

About the Author

maor tzivony
Israel Israel
Member
No Biography provided

Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board.
Search this forum  
    Spacing  Noise  Layout  Per page   
GeneralMy vote of 1memberHoward Richards5 Aug '09 - 6:16 
Poor example (works only for a single type of subject MIME encoding and doesn't support Q types) - no explanation with article etc.
GeneralWhere is the infomemberSoundman32.211 May '09 - 21:07 
Usually an article is:
1) Here is a problem
2) Here is a solution
3) Here is some code for that solution
 
You have done 1 and 3, where is 2?  
 
How do you determine Windows 1255 format emails?   I don't want to have to download your code and dig through the code.
 
It's a pity, because this is the sort of article I find interesting.
GeneralRe: Where is the info [modified]membermaor tzivony12 May '09 - 12:12 
Hay there,
first, thank you for pointing out my weakness in the article,
it's my first article and in the future I'll be better.
now, for the code issue, you don't need to dig to much in the code
because i have allot remarks in it, that will guide you through,
for your question of knowing what is winsows-1255 format in a mail,
it usually coming before the text as "?windows-1255?Q?", as you can see in the code,
i am searching in every part of the message (subject,body,ext..) for this pattern by using regex(regular expressions).
warning, the pattern "?windows-1255?B?" it's something else.
hope i could help,
maor.
 
modified on Tuesday, May 12, 2009 6:25 PM

GeneralRe: Where is the infomemberShani Natav13 May '09 - 11:32 
the pattern ?windows-1255?B? is not entirely different, it's just BASE64 encoded. did you forget? we talked about it just yesterday... Sleepy | :zzz:
Your'e sleeping at work again, aren't you?

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

Permalink | Advertise | Privacy | Mobile
Web02 | 2.6.130516.1 | Last Updated 11 May 2009
Article Copyright 2009 by maor tzivony
Everything else Copyright © CodeProject, 1999-2013
Terms of Use
Layout: fixed | fluid