FileSystem.exists() does not seem to be unicode-aware #5935

larsiusprime opened this Issue Jan 11, 2017 · 4 comments


None yet

4 participants

larsiusprime commented Jan 11, 2017 edited

Reproduction case:

  1. Create this file on your hard drive (I'm using windows):

  2. From your code, using hxcpp target, call:

What should happen:
The function should return true

What happens instead:
The function returns false

The error is in this call:

To this function:

And this function:

They use standard string functions rather than UTF-aware functions.

Not sure what the proper solution is, but left as-is, using FileSystem.exists() naively on the computer of a random person in, say, Russia, China, Japan, etc. could very well return false on requests when opening files from .e.g. their documents directory, which likely includes their username.


If you skip the FileSystem.exists() check and just use File.getContent() directly within a try/catch block to handle the non-exist case, you get an exception:


So it seems there is a need for UTF-aware filepath handling functions. I understand it might be a burden to change the standard library, but perhaps some new functions could be added, or provided in a separate library?

starry-abyss commented Jan 11, 2017 edited

Happens for me too on both Haxe 3.2.1 and Haxe 3.4-rc2.
I didn't use you filename, since I already have some files with Russian and English names. Also I just used filenames at the root directory instead of long paths.
I believe slashes in your path are single because github ate them?


Can you try with HashLink? It's using UTF16 system functions


Sure, what's the best way to compile a simple app with hashlink? I've never used it before.

Justinfront commented Jan 12, 2017 edited


It's pretty similar to Neko.
If your on windows get the hl.exe
hl downloads
or on linux / mac you can make yourself, simpler if your just make hl than make all since for all you need sdl etc... stuff installed which with my attempt with macports did not work but probably simpler on linux.

git clone
cd hashlink
make hl

you may need to specify the ARCH=32 or similar, and for the clone can't remember if there are submodules ( --recursive ).
Once you have hl make sure it can be found on terminal or put it next to your code.
For your actual program, it's the same as running neko vm using an hxml file and nightly haxe.

-hl output.hl 
-main Main
# mac probably...
-cmd ./hl output.hl
# windows probably...
-cmd hl.exe output.hl

Alternatively read

Hope that helps, probably simpler than you thought unless your on a mac and want to do graphics with it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment