[swift-users] Implementing String(contentOfUrl:usedEncoding)
mohit.athwani at gmail.com
Wed Feb 22 20:05:45 CST 2017
I am trying to contribute to open source software for the first time and
saw that in NSString.swift, a convenience initializer was not implemented
so I decided to work on it.
The initializer is:
public convenience init(contentsOf url:URL, usedEncoding enc:
I don't understand why we need the usedEncoding parameter? I understand
that it's a pointer but how do we decide what encoding to use? Do we
default to NSUTF8StringEncoding?
According to documentation:
Upon return, if url is read successfully, contains the encoding used to
interpret the data. For possible values, see NSStringEncoding.
My understanding is that the url would not be readable without knowing the
encoding to be applied?
What do you guys think?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the swift-users