diff options
author | Joey Hess <joey@kitenet.net> | 2011-02-10 14:58:09 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2011-02-10 14:58:09 -0400 |
commit | 0fef480bcaee9ae87f17d008a3787871d3bc9786 (patch) | |
tree | 0dcee699cec7f0fd6c78b9e838dd85626b7de9a5 /doc/bugs | |
parent | 52fa424faef63690d5b44cc4b6fd11aa67f1e619 (diff) |
update
Diffstat (limited to 'doc/bugs')
-rw-r--r-- | doc/bugs/problems_with_utf8_names.mdwn | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/doc/bugs/problems_with_utf8_names.mdwn b/doc/bugs/problems_with_utf8_names.mdwn index 58eb5ad1c..29213e1ec 100644 --- a/doc/bugs/problems_with_utf8_names.mdwn +++ b/doc/bugs/problems_with_utf8_names.mdwn @@ -63,3 +63,39 @@ It looks like the common latin1-to-UTF8 encoding. Functionality other than otupu > One other possible > issue would be that this could cause problems if git-annex were > translated. + +---- + +Simpler test case: + +<pre> +import Codec.Binary.UTF8.String +import System.Environment + +main = do + args <- getArgs + let file = decodeString $ head args + putStrLn $ "file is: " ++ file + putStr =<< readFile file +</pre> + +If I pass this a filename like 'ü', it will fail, and notice +the bad encoding of the filename in the error message: + +<pre> +$ echo hi > ü; runghc foo.hs ü +file is: ü +foo.hs: �: openFile: does not exist (No such file or directory) +</pre> + +On the other hand, if I remove the decodeString, it prints the filename +wrong, while accessing it right: + +<pre> +$ runghc foo.hs ü +file is: üa +hi +</pre> + +The only way that seems to consistently work is to delay decoding the +filename to places where it's output. But then it's easy to miss some. |