---
title: "init(decoding:)"
framework: swift
role: symbol
role_heading: Initializer
path: "swift/string/init(decoding:)-nm7v"
---

# init(decoding:)

Creates a string by interpreting the file path’s content as UTF-8 on Unix and UTF-16 on Windows.

## Declaration

```swift
init(decoding path: FilePath)
```

## Parameters

- `path`: The file path to be interpreted as CInterop.PlatformUnicodeEncoding.

## Discussion

Discussion If the content of the file path isn’t a well-formed Unicode string, this initializer replaces invalid bytes with U+FFFD. This means that, depending on the semantics of the specific file system, conversion to a string and back to a path might result in a value that’s different from the original path.

## See Also

### Creating a String

- [init()](swift/string/init().md)
- [init(_:)](swift/string/init(_:)-8v3fo.md)
- [init(_:)](swift/string/init(_:)-8og6g.md)
- [init(_:)](swift/string/init(_:)-1ip93.md)
- [init(_:)](swift/string/init(_:)-50pwi.md)
- [init(_:)](swift/string/init(_:)-14lv5.md)
- [init(repeating:count:)](swift/string/init(repeating:count:)-23xjt.md)
- [init(repeating:count:)](swift/string/init(repeating:count:)-11bpi.md)
- [init(unsafeUninitializedCapacity:initializingUTF8With:)](swift/string/init(unsafeuninitializedcapacity:initializingutf8with:).md)
