Open
Bug 32848
Opened 25 years ago
Updated 2 years ago
optimize code for 7bit check mail body
Categories
(MailNews Core :: Internationalization, enhancement)
MailNews Core
Internationalization
Tracking
(Not tracked)
NEW
People
(Reporter: nhottanscp, Unassigned)
Details
7 bit check mail body is used to relabel charset and transfer encoding as us-ascii, 7bit when the main body only contains characters in us-ascii range. Currently, the function is used which converts data to unicode and check each character if greater than 127. The code below was provided by ftang which does not do the unicode conversion but check charset specific marks (e.g. escape 0x1B). PRBool ContainOnlyAscii(const char* charset, const char* data, PRInt32 size) { if( strncmp(charset, "ISO-2022", 8) == 0) { // ISO-2022-JP, ISO-2022-CN, ISO-2022-KR for(char* p = data, PRInt32 i=0; i < size; i++, p++) { if( 0x1b == *p) // searching for ESC return PR_FALSE; } } else if( strcmp(charset, "HZ-GB-2312") == 0) { for(char* p = data, PRInt32 i=0; i < size-1; i++, p++) if(( '~' == *p) && ( '{' == *(p+1))) // searching for ~{ return PR_FALSE; } else { for(char* p = data, PRInt32 i=0; i < size; i++, p++) if( 0x80 & *p) // searching for 8 bits data return PR_FALSE; } return PR_TRUE; }
Reporter | ||
Updated•25 years ago
|
Status: NEW → ASSIGNED
Target Milestone: M17
Reporter | ||
Updated•24 years ago
|
Target Milestone: M17 → Future
Updated•20 years ago
|
Product: MailNews → Core
Assignee | ||
Updated•16 years ago
|
Product: Core → MailNews Core
Updated•16 years ago
|
QA Contact: ji → i18n
Updated•15 years ago
|
Assignee: nhottanscp → nobody
Severity: normal → enhancement
Status: ASSIGNED → NEW
Priority: P3 → --
Target Milestone: Future → ---
Updated•2 years ago
|
Severity: normal → S3
You need to log in
before you can comment on or make changes to this bug.
Description
•