473,806 Members | 2,874 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 2656
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
2467
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
7631
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
5404
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
7794
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
1429
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
9719
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
9597
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
10620
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
10369
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...
0
9187
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...
0
5546
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
5682
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3851
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3008
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.