Contents

init(decoding:)

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

Declaration

init(decoding component: FilePath.Component)

Parameters

  • component:

    The path component to be interpreted as CInterop.PlatformUnicodeEncoding.

Discussion

If the content of the path component 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 component might result in a value that’s different from the original path component.