Skip to content

Commit

Permalink
Document caveats for encodeWith
Browse files Browse the repository at this point in the history
  • Loading branch information
hasufell committed May 12, 2024
1 parent 9e4fd51 commit e7cb9fd
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion System/OsPath/Internal.hs
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,12 @@ unsafeEncodeUtf :: HasCallStack => String -> OsString
unsafeEncodeUtf = OS.unsafeEncodeUtf

-- | Encode a 'FilePath' with the specified encoding.
--
-- Note: on windows, we expect a "wide char" encoding (e.g. UCS-2 or UTF-16). Anything
-- that works with @Word16@ boundaries. Picking an incompatible encoding may crash
-- filepath operations.
encodeWith :: TextEncoding -- ^ unix text encoding
-> TextEncoding -- ^ windows text encoding
-> TextEncoding -- ^ windows text encoding (wide char)
-> FilePath
-> Either EncodingException OsPath
encodeWith = OS.encodeWith
Expand Down

0 comments on commit e7cb9fd

Please sign in to comment.