Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[cs] readDirectory bad encoding #8247

Closed
1 task
Aurel300 opened this issue May 3, 2019 · 0 comments · Fixed by #11551
Closed
1 task

[cs] readDirectory bad encoding #8247

Aurel300 opened this issue May 3, 2019 · 0 comments · Fixed by #11551
Labels
bug platform-cs Everything related to c# unicode
Milestone

Comments

@Aurel300
Copy link
Member

Aurel300 commented May 3, 2019

Put files whose names contain U+1FFFF, U+FFFFF, or U+10FFFF into a directory:

$ mkdir somedir
$ touch somedir/`printf "\xf0\x9f\xbf\xbf"` # U+1FFFF
$ touch somedir/`printf "\xf3\xbf\xbf\xbf"` # U+FFFFF
$ touch somedir/`printf "\xf4\x8f\xbf\xbf"` # U+10FFFF
$ ls somedir | xxd
0000000: f09f bfbf 0af3 bfbf bf0a f48f bfbf 0a    ...............

Read the directory with Haxe / C#:

class CsReadDirectory {
  public static function main():Void {
    trace(sys.FileSystem.readDirectory("somedir"));
  }
}
$ haxe --main CsReadDirectory --cs out.cs
$ mono out.cs/bin/CsReadDirectory.exe
FindNextFile: Bad encoding for 'somedir/�'
Consider using MONO_EXTERNAL_ENCODINGS

FindNextFile: Bad encoding for 'somedir/�'
Consider using MONO_EXTERNAL_ENCODINGS

FindNextFile: Bad encoding for 'somedir/�'
Consider using MONO_EXTERNAL_ENCODINGS

CsReadDirectory.hx:3: []

Expected output:

$ haxe --main CsReadDirectory --interp
CsReadDirectory.hx:3: [�,�,�]
$ haxe --main CsReadDirectory --interp | xxd
0000000: 4373 5265 6164 4469 7265 6374 6f72 792e  CsReadDirectory.
0000010: 6878 3a33 3a20 5bf0 9fbf bf2c f3bf bfbf  hx:3: [....,....
0000020: 2cf4 8fbf bf5d 0a                        ,....].

Tested on HFS+.

Once fixed:

  • re-enable tests marked with this issue number in tests/sys/src/TestUnicode.hx
@Aurel300 Aurel300 added bug platform-cs Everything related to c# unicode labels May 3, 2019
@RealyUniqueName RealyUniqueName added this to the Bugs milestone May 18, 2019
@Simn Simn modified the milestones: Bugs, Later Mar 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug platform-cs Everything related to c# unicode
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants