bug-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug #33244] NSXMLParser doesn't parse some gsdoc files due to encoding


From: Quentin Mathé
Subject: [bug #33244] NSXMLParser doesn't parse some gsdoc files due to encoding detection
Date: Fri, 06 May 2011 11:48:24 +0000
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.10) Gecko/20100915 Ubuntu/10.04 (lucid) Firefox/3.6.10

URL:
  <http://savannah.gnu.org/bugs/?33244>

                 Summary: NSXMLParser doesn't parse some gsdoc files due to
encoding detection
                 Project: GNUstep
            Submitted by: qmathe
            Submitted on: Fri 06 May 2011 11:48:23 AM GMT
                Category: Base/Foundation
                Severity: 3 - Normal
              Item Group: Bug
                  Status: None
                 Privacy: Public
             Assigned to: None
             Open/Closed: Open
         Discussion Lock: Any

    _______________________________________________________

Details:

GNUstep Base r32961

Hi,

When parsing some gsdoc files with a xml parser set up as below:

NSString *content = [NSString stringWithContentsOfFile: gsdocPath encoding:
NSUTF8StringEncoding error: NULL];

xmlParser = [[NSXMLParser alloc] initWithData: [aContent dataUsingEncoding:
NSUTF8StringEncoding]];

I observe that -[NSXMLParser initWithData:] isn't able to generate a valid
string from the data. 

Here is what a debugging session gives with NSData+Hash.gsdoc (in
attachment)...
The issue seems to be that -[GSMimeDocument encodingFromCharset:] in
-[SloppyXMLParser initWithData:] returns GSUndefinedEncoding rather than
NSUTF8StringEncoding.

Breakpoint 6, -[NSXMLParser initWithData:] (self=0x89655e0, _cmd=0x80bdb38,
data=0x898b510)
    at NSXMLParser.m:739
739       if (data == nil)
(gdb) n
745           self = [super init];
(gdb) 
746           if (self)
(gdb) 
750               _parser = [GSXMLParserIvars new];
(gdb) 
753               enc = [GSMimeDocument encodingFromCharset:
(gdb) 
755               if (enc == NSUTF8StringEncoding || enc == 
NSASCIIStringEncoding)
(gdb) 
763                   tmp = [[NSString alloc] initWithData: data encoding: enc];
(gdb) 
764                   this->data
(gdb) po tmp
Cannot access memory at address 0x0
(gdb) po data
<3c3f786d 6c207665 7273696f 6e3d2231 2e30223f 3e0a3c21 444f4354 59504520
6773646f 63205055 424c4943 20222d2f 2f474e55 73746570 2f2f4454 44206773
646f6320 312e302e 332f2f45 4e222022 68747470 3a2f2f77 77772e67 6e757374
65702e6f 72672f67 73646f63 2d315f30 5f332e64 7464223e 0a3c6773 646f6320
62617365 3d224e53 44617461 2b486173 68223e0a 20203c68 6561643e 0a202020
203c7469 746c653e [snip]
(gdb) p enc
$3 = GSUndefinedEncoding

Thanks,
Quentin.



    _______________________________________________________

File Attachments:


-------------------------------------------------------
Date: Fri 06 May 2011 11:48:23 AM GMT  Name: NSData+Hash.gsdoc  Size: 3kB  
By: qmathe

<http://savannah.gnu.org/bugs/download.php?file_id=23358>

    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?33244>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]