summaryrefslogtreecommitdiff
path: root/doc/bugs/Unicode_file_names_ignored_on_Windows/comment_7_b23a2bf106053f105798b270536057e5._comment
blob: b5cf90ef05a90cc1a4ec2c2981aa8c38958243a2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
[[!comment format=mdwn
 username="https://www.google.com/accounts/o8/id?id=AItOawk5aY0oBmuQtnoTNtji-dPgDw9p7J24YeY"
 nickname="Jiří"
 subject="further info 3"
 date="2014-03-19T16:23:58Z"
 content="""
Also ghc doesn't seem to do any weird transformations with that string

    import System.Process
    import qualified Data.ByteString as S
    import qualified Data.ByteString.UTF8 as U
    import GHC.IO.Handle
    
    files :: S.ByteString -> [S.ByteString]
    files ps
        | S.null ps = []
        | otherwise = case search ps of
                 Nothing -> [ps]
                 Just n  -> S.take n ps : files (S.drop (n+1) ps)
        where search = S.elemIndex 0
    
    main = do
        let prc = CreateProcess {
            cmdspec = RawCommand \"git\" [\"--work-tree=D:\\antest\",\"ls-files\",\"--others\",\"-z\",\"--\",\"h\225\269ky.txt\"],
            cwd = Nothing,
            env = Nothing,
            std_in = Inherit,
            std_out = CreatePipe,
            std_err = Inherit,
            close_fds = False,
            create_group = False }
        (_,Just out,_,_) <- createProcess prc
        hSetBinaryMode out True
        str <- S.hGetContents out
        print $ map U.toString $ files str

prints correctly [\"h\225\269ky.txt\"] I don't think that FilesystemEncoding will do any good on windows, since git seems to use utf-8 instead of normal windows console encoding.
"""]]