Convert REG_MULTI_SZ from Unicode to ANSI

K

Kerem Gümrükcü

Hi,

i have a byte[] that holds a bunch of data of type
REG_MULTI_SZ in UNICODE,. I must convert this
byte[] to a REG_MULTI_SZ in ANSI code. How
can i do this,...?

TIA,...

Regards

Kerem

--
 
A

Anthony Jones

Kerem Gümrükcü said:
Hi,

i have a byte[] that holds a bunch of data of type
REG_MULTI_SZ in UNICODE,. I must convert this
byte[] to a REG_MULTI_SZ in ANSI code. How
can i do this,...?

given src is byte[] and dst is byte[] and using System.Text is present:-

dst = Encoding.Default.GetBytes(Encoding.Unicode.GetString(src));

The dst will contain characters encoded with the systems default ANSI
codepage.
 
K

Kerem Gümrükcü

Hi Anthony,

thanks for the example, i solved it the same
way, but forget to post here. Thanks for your
reply,...


Regards

Kerem

--
-----------------------
Beste Grüsse / Best regards / Votre bien devoue
Kerem Gümrükcü
Latest Project: http://www.codeplex.com/restarts
Latest Open-Source Projects: http://entwicklung.junetz.de
-----------------------
"This reply is provided as is, without warranty express or implied."
Anthony Jones said:
Kerem Gümrükcü said:
Hi,

i have a byte[] that holds a bunch of data of type
REG_MULTI_SZ in UNICODE,. I must convert this
byte[] to a REG_MULTI_SZ in ANSI code. How
can i do this,...?

given src is byte[] and dst is byte[] and using System.Text is
present:-

dst = Encoding.Default.GetBytes(Encoding.Unicode.GetString(src));

The dst will contain characters encoded with the systems default ANSI
codepage.
 
M

Mihai N.

i have a byte[] that holds a bunch of data of type
REG_MULTI_SZ in UNICODE,. I must convert this
byte[] to a REG_MULTI_SZ in ANSI code. How
can i do this,...?
I know you have an answer, but in general I would try to stay Unicode
all the way. So, if you have a choice, you should try to convert
the components that takes ANSI to Unicode, instead of dumbing-down
your Unicode component.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top