diff options
author | erdgeist <> | 2008-06-10 16:46:02 +0000 |
---|---|---|
committer | erdgeist <> | 2008-06-10 16:46:02 +0000 |
commit | 5f30af6674f1ec462b99ff762ba5a29d3ff3d0e5 (patch) | |
tree | a17a62950826166f011cf1b41da019d3f407a405 /parsemail.js | |
parent | 1a8a6b05bb8fa26e1adfc6761dc2b7e4058b6083 (diff) |
Can now decode iso-2022-jp
Diffstat (limited to 'parsemail.js')
-rw-r--r-- | parsemail.js | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/parsemail.js b/parsemail.js index 361716e..1a5ceb2 100644 --- a/parsemail.js +++ b/parsemail.js | |||
@@ -1,5 +1,5 @@ | |||
1 | window.onload=function() { | 1 | window.onload=function() { |
2 | var url = '/'+window.location.search.substring(1); | 2 | var url = window.location.search.substring(1); |
3 | 3 | ||
4 | document.getElementById( "content" ).innerHTML = "<p><b>Fetching Mailbox... (this may take a while, please be patient...)</b><br/></p>"; | 4 | document.getElementById( "content" ).innerHTML = "<p><b>Fetching Mailbox... (this may take a while, please be patient...)</b><br/></p>"; |
5 | 5 | ||
@@ -104,15 +104,15 @@ function parsemail(mail) { | |||
104 | myMailHeader.appendChild( textElement ); | 104 | myMailHeader.appendChild( textElement ); |
105 | 105 | ||
106 | // Detect Content-Type and Content-Transfer-Encoding | 106 | // Detect Content-Type and Content-Transfer-Encoding |
107 | if( line.match( /Content-Type: / ) ) { | 107 | if( line.match( /^Content-Type:/ ) ) { |
108 | myContentType = line.replace( /^Content-Type: (.*?);?.*$/i, "$1" ); | 108 | myContentType = line.replace( /^Content-Type:\s*(.*?);?.*$/i, "$1" ); |
109 | myContentEncoding = line.replace( /^Content-Type: .*?;.*charset=\"?(.*?)\"?(?:;|$).*/i, "$1" ).toLowerCase(); | 109 | myContentEncoding = line.replace( /^Content-Type:\s*.*?;.*charset=\"?(.*?)\"?(?:;|$).*/i, "$1" ).toLowerCase(); |
110 | } else if( line.match( /Content-Transfer-Encoding: /i ) ) { | 110 | } else if( line.match( /Content-Transfer-Encoding:/i ) ) { |
111 | myContentTransferEncoding = line.replace( /Content-Transfer-Encoding: (.*)/i, "$1" ).toLowerCase(); | 111 | myContentTransferEncoding = line.replace( /Content-Transfer-Encoding:\s*(.*)/i, "$1" ).toLowerCase(); |
112 | } | 112 | } |
113 | 113 | ||
114 | // Check for MIME Mail | 114 | // Check for MIME Mail |
115 | if( line.match( /Content-Type: multipart.*boundary=.*/i ) ) { | 115 | if( line.match( /Content-Type:\s*multipart.*boundary=.*/i ) ) { |
116 | myState = myStates.inMultiPartMailHeader; | 116 | myState = myStates.inMultiPartMailHeader; |
117 | multiPartDivider = line.replace( /.*boundary=\"?(.*?)\"?$/gi, "--$1" ); | 117 | multiPartDivider = line.replace( /.*boundary=\"?(.*?)\"?$/gi, "--$1" ); |
118 | } | 118 | } |
@@ -201,11 +201,11 @@ function parsemail(mail) { | |||
201 | // Header lines may contain encoded words | 201 | // Header lines may contain encoded words |
202 | line = decode_header( line ); | 202 | line = decode_header( line ); |
203 | 203 | ||
204 | if( line.match( /Content-Type: / ) ) { | 204 | if( line.match( /Content-Type:/ ) ) { |
205 | myMultiContentType = line.replace( /Content-Type: (.*?);.*/, "$1" ).toLowerCase(); | 205 | myMultiContentType = line.replace( /Content-Type:\s*(.*?);.*/, "$1" ).toLowerCase(); |
206 | myMultiContentEncoding = line.replace( /Content-Type: .*?;.*charset=\"?(.*?)\"?(?:;|$).*/i, "$1" ).toLowerCase(); | 206 | myMultiContentEncoding = line.replace( /Content-Type:\s*.*?;.*charset=\"?(.*?)\"?(?:;|$).*/i, "$1" ).toLowerCase(); |
207 | } else if( line.match( /Content-Transfer-Encoding: /i ) ) { | 207 | } else if( line.match( /Content-Transfer-Encoding:/i ) ) { |
208 | myMultiContentTransferEncoding = line.replace( /Content-Transfer-Encoding: (.*?)/, "$1" ).toLowerCase(); | 208 | myMultiContentTransferEncoding = line.replace( /Content-Transfer-Encoding:\s*(.*?)/, "$1" ).toLowerCase(); |
209 | } | 209 | } |
210 | 210 | ||
211 | if( line.match( /.*name=/ ) ) { | 211 | if( line.match( /.*name=/ ) ) { |