ios - CFStringRef from char* without providing encoding type -


i have c string:

unsigned char* contents = readinfile(path); //sting bytes in unknown nsstringencoding encoding. 

i want know current nsstringencoding value of contents. want without using nsstring usedencoding methods.

i need cfstringref contents without introducting new string encoding.

nsstring* contentsstring = [nsstring stringwithcstring:(char *)contents]; 

introduces default encoding screws things up. how can create cfstringref dirctly contents?

once have can:

cfstringencoding cfstringencoding = cfstringgetfastestencoding((cfstringref)contentsstring); nsstringencoding encoding = cfstringconvertencodingtonsstringencoding(cfstringencoding); 


Comments

Popular posts from this blog

node.js - Bad Request - node js ajax post -

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -