Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to detect text file encoding in objective-c?

I want to know the text file encoding in objective-c. Can you explain me how to know that?

like image 464
Rizki Avatar asked Feb 24 '23 20:02

Rizki


1 Answers

You can use stringWithContentsOfFile:usedEncoding:error:, which returns, in addition to the new string, the encoding that was used.

I should note that this is a heuristic process by nature -- it's not always possible to determine the character encoding of a file.

like image 151
Daniel Dickison Avatar answered Mar 06 '23 23:03

Daniel Dickison