elixir-lang/elixir — pull request #1936 by fishcakez (2013-12-14 23:19:09+00:00)
Title: Potential fix for utf8 filenames

Please try the test case (see first commit) to see an example of the issue. This test should fail when `file:native_name_encoding/0` returns `latin1` (i.e. most OS's that aren't Mac or Windows). You can make it fail on any OS by adding the `+fnl` flag (see where the fourth commit adds the `+fnue` flag).

The second and third commits were useful to understand the modules better, specs are important. I can split them into a separate PR.

The fourth commit does what I believe is the correct behaviour for forcing UTF-8 everywhere for files. It adds the `+fnue` flag which will force native file name encoding to `utf8`. `binary` filenames are assumed to be utf-8 and converted to `char_list`s before being passed to `:file` and return types in a similar way to `Path.t` does. This means non-utf8 named files won't work, and will cause errors. It does require more tests before merging.