473,797 Members | 2,970 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

converting short to unicode without System.Text.Uni codeEncoding

hi, how can i convert type Short to Unicode strings? the
System.Text.Uni codeEncoding cant convert it if the length is too shrot....so
i need to do this manually. how can i do this
--
-iwdu15
Jul 13 '06 #1
6 2655
Aren't strings in dotnet in unicode by default?

Thus:
Dim s as short = 5
Dim u as string = CType(s, integer).ToStri ng()

Or am I completely missing the point here?

Jul 13 '06 #2

iwdu15 wrote:
hi, how can i convert type Short to Unicode strings? the
System.Text.Uni codeEncoding cant convert it if the length is too shrot....so
i need to do this manually. how can i do this
What do you mean? Values of type Short are numbers - do you just want
their decimal representations ? All .NET Strings are Unicode, so you
just need to say

Dim myShort As Short = 5
Dim myString As String = myShort.ToStrin g
Encodings are for translating between bytes and characters.

--
Larry Lard
Replies to group please
When starting a new topic, please mention which version of VB/C# you
are using

Jul 13 '06 #3
"iwdu15" <jmmgoalsteraty ahoodotcomschri eb:
hi, how can i convert type Short to Unicode strings?
I am not sure what you want to archieve, but maybe 'ChrW(x)' is what you are
looking for. Note that Microsoft unfortunately uses the term Unicode
instead of UTF-16. Strings are stored as UTF-16 in .NET.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Jul 13 '06 #4
thanks, what im trying to o is read in header information from WMA and MP3
files. i did some reading on it and the websites i went to said that the .NET
functions for to Unicode characters needed a length of atleast 256 bytes....
--
-iwdu15
Jul 13 '06 #5
256 bytes per unicode character? Wow, I don't think there are that many
alphabets in the Universe.

Is that statement even correct if you had of said 256 bits ? Thats 32
bytes I think. Thats, what, a double?

I'm just confusing myself.

iwdu15 wrote:
thanks, what im trying to o is read in header information from WMA and MP3
files. i did some reading on it and the websites i went to said that the .NET
functions for to Unicode characters needed a length of atleast 256 bytes....
--
-iwdu15
Jul 13 '06 #6
"Steven Nagy" <le*********@ho tmail.comschrie b:
256 bytes per unicode character? Wow, I don't think there are that many
alphabets in the Universe.

Is that statement even correct if you had of said 256 bits ? Thats 32
bytes I think. Thats, what, a double?
In UTF-32 each character is encoded using 32 bits (4 bytes). UTF-16 uses 16
bits per character and 32 bits (surrogate pairs) for some Chinese
characters.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Jul 13 '06 #7

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

Similar topics

4
2466
by: Majed | last post by:
Hi , all I'm trying to write unicode to a file for another app (not developed with vs2003) to read it. I used StreamWriter with unicode encoding.but I was surprised that the streamwriter adds FFFE to the start of the file,which stopes the other app from reading it!! any idea how to stope it frome doing that,do I have to use another class #####writer that supports unicode? help me Please! Thanks
6
2794
by: dbaldi | last post by:
(this is follow-on message to one posted yesterday) I'm trying to reproduce the capabilities in both Notepad and Excel, whereby a Unicode text file with Unicode characters can be converted to ANSI, while still preserving the unicode characters within. Specifically, I'm using the unicode character &x2022, which is a largish bullet. I've tried this:
1
7622
by: Linda Chen | last post by:
I need to write some unicode symbols such as degree symbol (for example 36°) by using XMLTextWrite but couldn't make it work. I found the degree char in unicode is '\u030A' and here is my sample code: char myChar = '\u030A'; string myString = "36" + myChar.ToString(); myWriter.WriteString(myString); it doesn't work.
5
3338
by: srikant | last post by:
I am writing a client in C# that needs to communicate over the network to a legacy C++ application that uses Unicode strings. I realize that C# strings are already in Unicode, however, how do I account for the network order transformation. Can I simply do the equivalent of string = "hello world"; // this is a unicode strings (2 bytes per char) bytes buffer = UnicodeEncoding.GetBytes(str); myNetworkStream.Write(buffer, 0, buffer.Length); ...
6
2490
by: Tom | last post by:
Hi I read http://dotgnu.org/pnetlib-doc/System/Text/UnicodeEncoding.html#UnicodeEncoding.GetBytes%28System.String%29%20Method and here is my code: <code string c = "Hello, How are you today?"; //it should be other language, not English UnicodeEncoding Unicode = new UnicodeEncoding() byte encodedBytes = Unicode.GetBytes(c)
4
5401
by: Prabhu | last post by:
Hi, We are having problem in converting a byte array to string, The byte array has char(174), char(175), char(240), char(242) and char(247) as delimiters for the message. when we use "System.Text.Encoding.ASCII.GetString(bytearray)" of .Net library, we found that the char (delimiters) specified above are replaced with different char.
1
1979
by: WO70 | last post by:
Hi, maybe someone had the same problem: http://support.microsoft.com/kb/895262/en-us This Hotfix is only available for Windows 2003, but we also use Windows 2000 and for development Windows XP. So I thought ASP.NET 2.0 will make things better. And now ASP.NET is there and I found this:
12
7791
by: Mark Rae | last post by:
Hi, Can anyone please tell me how to convert an unserializeable object say, a System.Web.Mail.MailMessage object, to a byte array and then convert the byte array to a Base64 string? Any assistance gratefully received. Best regards,
10
1428
by: Samuel | last post by:
Hi I am trying to read text files that are saved in ANSI format with Unicode characters such as French e German big S etc, and as I read the file these characters appear as squares etc. I know that if the file would be saved as Unicode this wouldn't be a problem. The question is whether there is an option that when I create the Stream
0
9685
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
9536
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10468
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10021
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
6802
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();...
0
5458
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5582
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4131
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
3748
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.