w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
How do I solve the error about encoding ?

Error 264 means NSString couldn't determine the encoding of the file; therefore you need to tell it what the encoding is, which is probably UTF-8:

NSString *pageSource = [[NSString alloc]
initWithContentsOfFile:path
                                                      
encoding:NSUTF8StringEncoding
                                                         
error:&error];

In order to find what Error 264 means I looked in FoundationErrors.h:

NSFileReadUnknownStringEncodingError NS_ENUM_AVAILABLE(10_5,
2_0) = 264, // Read error (string encoding of file contents could not be
determined)

Which I found in my Xcode app contents using the find command:

$ cd
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform
$ find . -name *.h -exec fgrep -l 264 {} ;
./Developer/SDKs/iPhoneOS6.1.sdk/System/Library/Frameworks/AVFoundation.framework/Headers/AVAssetExportSession.h
(lots of others deleted)
./Developer/SDKs/iPhoneOS6.1.sdk/System/Library/Frameworks/Foundation.framework/Headers/FoundationErrors.h




© Copyright 2018 w3hello.com Publishing Limited. All rights reserved.