<!--
{
  "availability" : [
    "iOS: 8.0.0 -",
    "iPadOS: 8.0.0 -",
    "macCatalyst: 13.0.0 -",
    "macOS: 10.10.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Swift",
  "identifier" : "/documentation/Swift/Unicode/UTF8/transcode(_:from:)",
  "metadataVersion" : "0.1.0",
  "role" : "Type Method",
  "symbol" : {
    "kind" : "Type Method",
    "modules" : [
      "Swift"
    ],
    "preciseIdentifier" : "s:s7UnicodeO4UTF8O9transcode_4froms06_ValidB6BufferVSg13EncodedScalarQz_xmts01_A8EncodingRzlFZ"
  },
  "title" : "transcode(_:from:)"
}
-->

# transcode(_:from:)

Converts a scalar from another encoding’s representation, returning
`nil` if the scalar can’t be represented in this encoding.

```
static func transcode<FromEncoding>(_ content: FromEncoding.EncodedScalar, from _: FromEncoding.Type) -> Unicode.UTF8.EncodedScalar? where FromEncoding : _UnicodeEncoding
```

## Discussion

A default implementation of this method will be provided
automatically for any conforming type that does not implement one.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)