Unicode filename reading in C#
Let me explain situation =/
My comrade developing some editor for pw. It works fine but dont opens .dds with unicode coded names.
The aim is opening .dds files with Chinese names (Unicode).
He have library for opening .dds, but it opens only files with ASCII names and we dont have sources of that lib to upgrade it.
What can you advice for that purposes? Maybe some Unicode -> ASCII name converter or some lib, which opens .dds with chinese names?
If you help to fix this issue, maybe he will lower price for rz devs :laugh:
Re: Unicode filename reading in C#
When I needed unicode support I casted all strings into array of byte. Since unicode character is 2 byte, just write a string handler class which extends C#'s normal one - I dont like C# that much, but this was possible without s problem in delphi.
I thought that Widestring is avaliable as default data type in C#?
Cheers
Re: Unicode filename reading in C#
Quote:
Originally Posted by
Swoosh91
I thought that Widestring is avaliable as default data type in C#?
Cheers
It is... Encoding.Unicode is UTF-16LE and there are a bunch of other available encoding to use... Heck even GB2312 is supported Encoding.GetEncoding("GB2312")
You don't need to do any kind of byte array casting to get different character support. I'm assuming that whatever library they are using for dds files uses Encoding.ASCII for filename handling...
(and to answer question about Unicode to ASCII (Even though it won't help) Encoding.ASCII.GetString(Encoding.Unicode.GetBytes(stringVar));)