<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="" applecontenteditable="true"><div class="">My knee-jerk reaction is to say it's too late in Swift 4 for this kind of change, but with that out of the way, I'm most concerned about what it means to have, say, a UTF-8 index that's not on a UTF-16 boundary.</div><div class=""><br class=""></div><blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;" class=""><div class="">let str = "言"</div><div class="">let oneUnitIn = str.utf8.index(after: str.utf8.startIndex)</div><div class="">let trailingBytes = str.utf8[oneUnitIn...]</div></blockquote><div class=""><br class=""></div><div class="">What can I do with 'oneUnitIn'? How do I test to see if it's on a Character boundary or a UnicodeScalar boundary?</div><div class=""><br class=""></div><div class="">Jordan</div><div class=""><br class=""></div><br class=""><div><blockquote type="cite" class=""><div class="">On May 27, 2017, at 10:40, Dave Abrahams via swift-evolution <<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div class=""><br class="">Pretty version: <a href="https://github.com/dabrahams/swift-evolution/blob/string-index-overhaul/proposals/NNNN-string-index-overhaul.md" class="">https://github.com/dabrahams/swift-evolution/blob/string-index-overhaul/proposals/NNNN-string-index-overhaul.md</a><br class=""><br class="">----<br class=""><br class=""># String Index Overhaul<br class=""><br class="">* Proposal: [SE-NNNN](NNNN-string-index-overhaul.md)<br class="">* Authors: [Dave Abrahams](<a href="https://github.com/dabrahams" class="">https://github.com/dabrahams</a>)<br class="">* Review Manager: TBD<br class="">* Status: **Awaiting review**<br class="">* Pull Request Implementing This Proposal: <a href="https://github.com/apple/swift/pull/9806" class="">https://github.com/apple/swift/pull/9806</a> <br class=""><br class="">*During the review process, add the following fields as needed:*<br class=""><br class="">## Introduction<br class=""><br class="">Today `String` shares an `Index` type with its `CharacterView` but not<br class="">with its `UTF8View`, `UTF16View`, or `UnicodeScalarView`. This<br class="">proposal redefines `String.UTF8View.Index`, `String.UTF16View.Index`,<br class="">and `String.CharacterView.Index` as typealiases for `String.Index`,<br class="">and exposes a public `encodedOffset` property and initializer that can<br class="">be used to serialize and deserialize positions in a `String` or<br class="">`Substring`.<br class=""><br class="">Swift-evolution thread: [Discussion thread topic for that proposal](<a href="https://lists.swift.org/pipermail/swift-evolution/" class="">https://lists.swift.org/pipermail/swift-evolution/</a>)<br class=""></div></div></blockquote></div><br class=""></body></html>