473,326 Members | 2,147 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

Convert REG_MULTI_SZ from Unicode to ANSI

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

--
-----------------------
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."

Sep 16 '08 #1
3 2833
"Kerem Gümrükcü" <ka*******@hotmail.comwrote in message
news:%2******************@TK2MSFTNGP02.phx.gbl...
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.GetStri ng(src));

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

--
Anthony Jones - MVP ASP/ASP.NET

Sep 16 '08 #2
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" <An***********@yadayadayada.comschrieb im Newsbeitrag
news:OU**************@TK2MSFTNGP02.phx.gbl...
"Kerem Gümrükcü" <ka*******@hotmail.comwrote in message
news:%2******************@TK2MSFTNGP02.phx.gbl...
>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.GetStri ng(src));

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

--
Anthony Jones - MVP ASP/ASP.NET
Sep 16 '08 #3
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.
--
Mihai Nita [Microsoft MVP, Visual C++]
http://www.mihai-nita.net
------------------------------------------
Replace _year_ with _ to get the real email
Sep 17 '08 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Morten Overgaard | last post by:
Hi How do I convert a managed System::String to a CString. I need to handle unicode characters ( Japan and Chinese ) as well as "normal" ANSI characters. I have tried the following char* p...
4
by: Julia | last post by:
Hi, I need to convert unicode string to ansi string Thanks in adavance.
3
by: nicksop | last post by:
How Can I convert ANSI to OEM with StreamWriter ?
2
by: Clay | last post by:
I need to convert a unicode string to an ansi string. This should not be difficult but I simply cannot find a way to do this. Anyone?
8
by: csanjith | last post by:
Hi, i have a situaion where i need to convert the characters entered in an text field to upper case using C. The configuration id utf8 environment in which user can enter any character (single ,...
1
by: recover | last post by:
#include <xxx> int main() { const wchar* pwcHello=L"hello"; char* pcHello; xxxxxx //do something using stl cout<<pcHello<<endl; } =============out===========
9
by: emagzz | last post by:
Hi all, I need to convert many text file from ANSI to UNICODE. Some body knows if there is a free utility that can do this from the command line so as I can use it inside a batch file. ...
1
codexparse
by: codexparse | last post by:
I am writing a browser program in C++ Builder 6 that loads a web page using the following code: void __fastcall TForm1::ToolButton1Click(TObject *Sender) { wchar_t buff; ...
4
by: Peter | last post by:
Does anyone know how to convert the following VB6 code to C# code? Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (dest As Any, Source As Any, ByVal bytes As Long) Dim...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.