473,769 Members | 5,900 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 2860
"Kerem Gümrükcü" <ka*******@hotm ail.comwrote in message
news:%2******** **********@TK2M SFTNGP02.phx.gb l...
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.Defaul t.GetBytes(Enco ding.Unicode.Ge tString(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.co mschrieb im Newsbeitrag
news:OU******** ******@TK2MSFTN GP02.phx.gbl...
"Kerem Gümrükcü" <ka*******@hotm ail.comwrote in message
news:%2******** **********@TK2M SFTNGP02.phx.gb l...
>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.Defaul t.GetBytes(Enco ding.Unicode.Ge tString(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
25551
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 = (char*)System::Runtime::InteropServices::Marshal::StringToHGlobalAnsi(
4
79657
by: Julia | last post by:
Hi, I need to convert unicode string to ansi string Thanks in adavance.
3
7845
by: nicksop | last post by:
How Can I convert ANSI to OEM with StreamWriter ?
2
13923
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
20327
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 , double, triple byte etc). I need to convert to upper case only those characters which has got upper case. ie if an user enter bot english and japanese characters in the text field, then I should convert only english characters, not japanese.
1
3363
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
13650
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. Thank you Emanuele
1
14975
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; MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, "http://www.thescripts.com", -1, buff, sizeof(buff)); CppWebBrowser1->Navigate(buff, 0, 0, 0, 0); } To include the address bar implementation, I need a temporary string derived from an edit box. This is...
4
4660
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 sngArray(0) As Single strString = Chr$(107) & Chr$(62) & Chr(139) & Chr$(65) CopyMemory sngArray(0), ByVal strString, Len(strString) After running the code sngArray(0) = 17.40548
0
9586
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10043
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9990
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9861
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8869
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7406
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6672
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
3956
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3561
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.