Changeset 277 for branches/LogicMail-1.0/LogicMail/src/org/logicprobe/LogicMail/util/StringParser.java
- Timestamp:
- 08/26/08 08:06:55 PM (4 months ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
branches/LogicMail-1.0/LogicMail/src/org/logicprobe/LogicMail/util/StringParser.java
r274 r277 732 732 break; 733 733 } 734 try { 735 int charVal = Integer.parseInt(text.substring(index+1, index+3), 16); 736 buffer.append((char)charVal); 737 } catch (NumberFormatException exp) { } 738 index += 3; 734 else { 735 char ch1 = text.charAt(index+1); 736 char ch2 = text.charAt(index+2); 737 if(ch1 == '\r' && ch2 == '\n') { 738 index += 3; 739 } 740 else if(ch1 == '\n') { 741 index += 2; 742 } 743 else { 744 try { 745 int charVal = Integer.parseInt(text.substring(index+1, index+3), 16); 746 buffer.append((char)charVal); 747 } catch (NumberFormatException exp) { } 748 index += 3; 749 } 750 } 739 751 } 740 752 else { … … 753 765 char ch; 754 766 String charStr; 755 for(int i=0; i<text.length(); i++) { 767 int length = text.length(); 768 for(int i=0; i<length; i++) { 756 769 ch = text.charAt(i); 757 if(ch < 128) { 770 if(ch != '\t' && ch != ' ' && ch < 128) { 771 if(buffer.length() == 75 && i < length - 1) { 772 buffer.append("=\r\n"); 773 } 758 774 buffer.append(ch); 759 775 } 760 776 else { 761 charStr = Integer.toHexString((int)ch); 777 if(buffer.length() == 73 && i < length - 3) { 778 buffer.append("=\r\n"); 779 } 780 charStr = Integer.toHexString((int)ch).toUpperCase(); 762 781 buffer.append('='); 763 782 if(charStr.length() == 1) { … … 767 786 } 768 787 } 788 769 789 return buffer.toString(); 770 790 }
