Ticket #3307 (closed bug: fixed)
System.IO and System.Directory functions not Unicode-aware under Unix
| Reported by: | YitzGale | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | 7.2.1 |
| Component: | libraries/base | Version: | 6.11 |
| Keywords: | directory unicode | Cc: | batterseapower@… |
| Operating System: | Unknown/Multiple | Architecture: | Unknown/Multiple |
| Type of failure: | None/Unknown | Difficulty: | Unknown |
| Test Case: | Blocked By: | ||
| Blocking: | Related Tickets: |
Description
Under Unix, file paths are represented as raw bytes in a String. That is not user-friendly, because a String is supposed to be decoded Unicode, and it is conventional in Unix to view those raw bytes as encoded according to the current locale. In addition, this is not consistent with Windows, where file paths are natively Unicode and represented as such in the String. (Well, they will be consistently once #3300 is completed.)
On the other hand, this raises various complications (what about encoding errors, and what if encode.decode is not the identity due to normalisation, etc.)
The following cases ought to work consistently for all file operations in System.IO and System.Directory:
- A FilePath from getArgs
- A FilePath from getDirectoryContents
- A FilePath in Unicode from a String literal,
- A FilePath read from a Handle and decoded into Unicode
See discussion in the thread http://www.haskell.org/pipermail/haskell-cafe/2009-June/062795.html
