[OGo-Developer] question to bug 1753

Sebastian Reitenbach developer@opengroupware.org
Wed, 01 Nov 2006 06:33:50 -0000


Hi,

I was looking for the cause of bug:
http://bugzilla.opengroupware.org/bugzilla/show_bug.cgi?id=1753
the stripped underscores from mail bodies.

in December 5005 Helge added sth. that replaces _ with spaces to the 
file NGQuotedPrintableCoding.m in function NGDecodeQuotedPrintable, to conform 
with the RFC.

some time earlier in code, method bodyAsString from implemented in 
LSWTextPlainBodyViewer.m is called. This method starts with this code:

- (NSString *)bodyAsString {
  NSString *s;
  NSData   *data;
  NSString *en;

  if ([self->body isKindOfClass:[NSString class]])
    return self->body;

  if ([self->body isKindOfClass:[NSURL class]]) {
    NSString *part;

    part = [[[self->body query] componentsSeparatedByString:@"="] lastObject];
    data = [self->source contentsOfPart:part];
  }
  else if ([self->body isKindOfClass:[NSData class]])
    data = self->body;

  if ((en = [[self encoding] lowercaseString]) != nil) {
    if ([en isEqualToString:@"quoted-printable"]) {
        data = [data dataByDecodingQuotedPrintable];
    }
    else if ([en isEqualToString:@"base64"]) {
        data = [data dataByDecodingBase64];
    }
  }


self->body is isKindOfClass:[NSURL class], a url looking like 
imap://imaphost/path/to/mail
the data is quoted-printable, after the line
data = [data dataByDecodingQuotedPrintable];
the data has the _ replaced with spaces.

when I look at the data before that line, the _ is encoded as 5F, after that 
line, there where the _ was, I see now a 0x20, a space. Therefore I removed 
this replacement.

I am not sure, whether I am correct in removing the replacement of _ with 
spaces, or if the _ are not correctly encoded in the first place.

anybody can give me some insights?

kind regards
Sebastian




-- 
Sebastian Reitenbach            Tel.: ++49-(0)3381-8904-451
RapidEye AG                     Fax: ++49-(0)3381-8904-101    
Molkenmarkt 30                  e-mail:reitenbach@rapideye.de     
D-14776 Brandenburg             web:http://www.rapideye