Uploaded image for project: 'Swift'
  1. Swift
  2. SR-5397

String.addingPercentEncoding sometimes encodes allowed characters

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Medium
    • Resolution: Invalid
    • Component/s: Foundation
    • Labels:
      None
    • Environment:

      Xcode 9 beta 2, Swift 4

      Description

      import Foundation
      
      CharacterSet.urlHostAllowed.contains(":") // true
      
      ":".addingPercentEncoding(withAllowedCharacters: CharacterSet.urlHostAllowed) // "%3A"
      // actual result: "%3A"
      // expected result: ":"
      
      ":".addingPercentEncoding(withAllowedCharacters: CharacterSet(charactersIn: ":")) // ":"
      // actual result: ":"
      // expected result: ":"
      

        Attachments

          Activity

            People

            Assignee:
            Unassigned
            Reporter:
            marc Marc Knaup
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: