topfunky / hpple

An XML/HTML parser for Objective-C, inspired by Hpricot.
http://topfunky.com
MIT License
2.78k stars 473 forks source link

Encoding should be passed as NSStringEncoding, not NSString #34

Open gdaolewe opened 10 years ago

gdaolewe commented 10 years ago

Now that we can initialize a TFHpple with an encoding parameter, one has to search through the libxml2 code to find what literal values are allowed for the encoding. This is not in keeping with the way string encoding is handled throughout Objective-C. Instead hppleWithHTMLData: encoding: and similar methods should take an NSStringEncoding enum, such as NSUTF8StringEncoding or NSISOLatin1StringEncoding, and then pass the appropriate encoding string to libxml2.

Unfortunately this would break compatibility of the API for anyone already using the new with-encoding methods; perhaps still more methods like hppleWithHTMLData: enumEncoding: should be created?

eappel commented 9 years ago

Do you know I can find the string value for NSUTF8StringEncoding?