ios - encoding information in filenames (iPhone/mac) -



ios - encoding information in filenames (iPhone/mac) -

i want encode short title in filenames. problem title contain character such colon or slash. there standard encoding typical/appropriate this?

edit: clarify, want encode title in such way encoded title used filename. or called percent escaping?

the way category on nsurl, utilize nsurl filename in particular directory. 1 time have nsurl, can fetch or save file using url after performing usual checks whether or not file exists , handling cases accordingly.

the relevant code snippet is:

+ (nsurl *)adnurlforfilename:(nsstring *)filename indirectory:(nssearchpathdirectory)searchdirectory { nsstring *percentescapedfilename = [filename stringbyaddingpercentescapesusingencoding:nsutf8stringencoding]; nsfilemanager *filemanager = [[nsfilemanager alloc] init]; nsurl *urlfordirectory = [[filemanager urlsfordirectory:searchdirectory indomains:nsuserdomainmask] objectatindex:0]; homecoming [nsurl urlwithstring:percentescapedfilename relativetourl:urlfordirectory]; }

you can download total category code github - nsurl+adnfilehelpers

iphone ios osx encoding

Comments

Popular posts from this blog

How do I check if an insert was successful with MySQLdb in Python? -

delphi - blogger via idHTTP : error 400 bad request -

postgresql - ERROR: operator is not unique: unknown + unknown -