Convert charset name to NSStringEncoding

Posted by d11wtq on Stack Overflow See other posts from Stack Overflow or by d11wtq
Published on 2010-05-23T10:18:56Z Indexed on 2010/05/23 10:20 UTC
Read the original article Hit count: 651

Filed under:
|
|
|

Given a charset string, such as "utf-8", "iso-8859-1", "us-ascii" etc, is there any built-in way to get the appropriate NSStringEncoding in Cocoa?

Right now I'm looking at just building a NSDictionary containing a canonicalized version of the name mapped to the NSStringEncoding, then having a lookup mechanism that canonicalizes the input in the same way. But is there really no way to get NSUTF8StringEncoding given the string "UTF-8", etc?

© Stack Overflow or respective owner

Related posts about objective-c

Related posts about cocoa