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, > > >

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

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

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

2017-06-21 Thread Andy Best via swift-corelibs-dev
Hey, I've been looking at the init(contentsOfFile, usedEncoding) initializer for NSString in corelibs-foundation. Am I right in thinking that this initializer should use some method to attempt to detect the character encoding of the file before returning a decoded String? If so, I've been