2

I write a file called "Blaitière.bytes" in C# on OSX. Then I list all files using Directory.GetFiles, I get "Blaitie`re.bytes" instead. Is there a way to convert from one to another? i.e. is there a method for me to know to what my filename will be converted to?

Paulius Liekis
  • 1,676
  • 3
  • 18
  • 26
  • 1
    you could always make your own, it seems that acutes are encoded as ` preceded by the letter so I assume that circumflexes are similarly encoded, just try the various symbols and then see how they end up being encoded, also have a look at http://symbolcodes.tlt.psu.edu/web/codehtml.html it should be how the filenames are encoded – Cjen1 Nov 09 '15 at 23:13
  • 1
    You're probably seeing *U+0300 — COMBINING GRAVE ACCENT*. If you render that string it should show up properly as "Blaitière.bytes" – roeland Nov 10 '15 at 01:15

1 Answers1

1

This answer (https://stackoverflow.com/a/6153713/217022) explains why it happens - file names on OSX have to be in fully decomposed unicode, so calling:

string path = ...my path...
path = path.Normalize(System.Text.NormalizationForm.FormKD); 

solves the problem.

Community
  • 1
  • 1
Paulius Liekis
  • 1,676
  • 3
  • 18
  • 26