Re: [swift-corelibs-dev] Foundation: NSString init detect encoding

2017-06-21 Thread Andy Best via swift-corelibs-dev
Is the preferred approach to mirror Foundation as closely as possible (e.g. under Linux basically do nothing), or is implementing something like stringEncodingForData under the hood preferable in this case? On 21 June 2017 at 17:43, Tony Parker wrote: > Hi Andy, > > > On Jun 21, 2017, at 7:39 AM

Re: [swift-corelibs-dev] Foundation: NSString init detect encoding

2017-06-21 Thread Tony Parker via swift-corelibs-dev
Someone on the team here just reminded me that we do have a very basic form of encoding detection here as well: just looking for the BOM at the beginning of the data. - Tony > On Jun 21, 2017, at 9:55 AM, Tony Parker via swift-corelibs-dev > wrote: > > Our preferred approach so far is to mir

Re: [swift-corelibs-dev] Foundation: NSString init detect encoding

2017-06-21 Thread Tony Parker via swift-corelibs-dev
Our preferred approach so far is to mirror Foundation as closely as possible. I don’t know if we want to implement stringEncodingForData as part of swift-corelibs-foundation. In any case, we are trying to avoid bringing in as few dependencies outside of the Swift project itself as possible, to k

Re: [swift-corelibs-dev] Foundation: NSString init detect encoding

2017-06-21 Thread Tony Parker via swift-corelibs-dev
Hi Andy, > On Jun 21, 2017, at 7:39 AM, Andy Best via swift-corelibs-dev > wrote: > > Hey, > > I've been looking at the init(contentsOfFile, usedEncoding) initializer for > NSString in corelibs-foundation. > > Am I right in thinking that this method should use some method to attempt to > d