Re: NSXMLParser initWIthData - Encoding?
Re: NSXMLParser initWIthData - Encoding?
- Subject: Re: NSXMLParser initWIthData - Encoding?
- From: "Gary L. Wade" <email@hidden>
- Date: Fri, 21 May 2010 10:47:04 -0700
- Thread-topic: NSXMLParser initWIthData - Encoding?
You can read more about the XML spec here:
http://www.w3.org/standards/xml/
Citing your other example, the PNG specification is here:
http://www.w3.org/TR/PNG/
>From the documentation, you can learn how the character set is specified in
XML and how PNG data is stored, be that in 24-bit, 8-bit, interlaced, etc.
On 05/21/2010 10:34 AM, "Patrick Rutkowski" <email@hidden> wrote:
> I really hope you're joking.
>
> Do you really not see that it's completely non-obvious if it's supposed to be
> UTF-8 or UTF-16?
>
> -Patrick
>
> On May 21, 2010, at 1:31 PM, Gary L. Wade wrote:
>
>> The name of the class makes it pretty obvious to everyone that the data is
>> XML.
>>
>> On 05/21/2010 10:23 AM, "Patrick Rutkowski" <email@hidden> wrote:
>>
>>> Milder tone? No thanks.
>>>
>>> Any API that accepts binary data needs to give at least a hint as to what
>>> format the binary data should be. Saying that just it accepts "data" is
>>> disgusting. Period, end of argument.
>>>
>>> Actually, maybe there is one more thing to be said:
>>>
>>> Perhaps if the class is something like PNGImage then you can have an
>>> initWithData method which says that it accepts just "data", because in that
>>> that case it's plainly obviously what format it's supposed to be. But this
>>> isn't such a case.
>>>
>>> If you want to advocate that it's perfectly fine to omit information about
>>> the
>>> format of binary data, then you're just a moron. I'm not saying that you're
>>> a
>>> moron for accidentally forgetting to document it, but if you want to say (as
>>> you seem to be doing) that it's OK to consciously leave it out, then you're
>>> just a moron.
>>>
>>> -Patrick
>>>
>>> On May 21, 2010, at 1:07 PM, Kyle Sluder wrote:
>>>
>>>> On Fri, May 21, 2010 at 9:39 AM, Patrick Rutkowski <email@hidden>
>>>> wrote:
>>>>> I find it disgusting that the doc section for NSXMLParser initWithData
>>>>> takes
>>>>> binary data, but doesn't tell you which encoding it's supposed to be?
>>>>>
>>>>> Link:
>>>>> http://developer.apple.com/mac/library/documentation/cocoa/reference/found
>>>>> at
>>>>> ion/Classes/NSXMLParser_Class/Reference/Reference.html#//apple_ref/occ/ins
>>>>> tm
>>>>> /NSXMLParser/initWithData:
>>>>>
>>>>> I'm still pretty new to XML though, does the encoding always have to be
>>>>> UTF-8, or perhaps always UTF-16?
>>>>
>>>> You find it "disgusting," yet you admit you're new? Perhaps a milder
>>>> tone is warranted here?
>>>>
>>>>> Either way, which encoding does initWithData expect to get? Does it
>>>>> perhaps
>>>>> detect which encoding is being used, based on the data you give it?
>>>>
>>>> Please read the relevant section of the XML spec, keeping in mind that
>>>> it is non-normative:
>>>>
>>>> http://www.w3.org/TR/REC-xml/#sec-guessing
>>>>
>>>> --Kyle Sluder
>>
>>
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden