Skip to content

Commit e7cb9fd

Browse files
committed
Document caveats for encodeWith
See haskell/os-string#15
1 parent 9e4fd51 commit e7cb9fd

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

System/OsPath/Internal.hs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,12 @@ unsafeEncodeUtf :: HasCallStack => String -> OsString
5656
unsafeEncodeUtf = OS.unsafeEncodeUtf
5757

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

0 commit comments

Comments
 (0)