0

I have received a file from a Mac and want to convert it to a proper Windows filename using c# or vb.net.

This is the filename: SXXXX-NN-AA-02301-C-Typenübersicht 2020.dwg.

This is what it should be: SXXXX-NN-AA-02301-C-Typenübersicht 2020.dwg.

How do I convert this properly?

D_00
  • 1,440
  • 2
  • 13
  • 32
tosch
  • 1

1 Answers1

0

This is a UTF-8 to UTF-16 conversion issue. The "╠ê" is the escaped "ü", but Windows isn't picking up the escaping.

Something like:

     bUTF8 = GetRawBytes(fileNameGoesHere);
  bUnicode = Encoding.Convert(Encoding.UTF8, Encoding.Unicode, bUTF8);
  strUnicode = Encoding.Unicode.GetString(bUnicode);

should work. You might need to play with Encoding.UTF8/Encoding.UTF16 parameters.

Technologeeks
  • 7,674
  • 25
  • 36
  • I can't convert the filename to a byte array since the ASCII value of the ╠ character is 9568. – tosch May 19 '21 at 06:55