473,378 Members | 1,347 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,378 software developers and data experts.

converting short to unicode without System.Text.UnicodeEncoding

hi, how can i convert type Short to Unicode strings? the
System.Text.UnicodeEncoding 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 2628
Aren't strings in dotnet in unicode by default?

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

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.UnicodeEncoding 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.ToString
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" <jmmgoalsteratyahoodotcomschrieb:
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*********@hotmail.comschrieb:
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
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...
6
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...
1
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...
5
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...
6
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?";...
4
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...
1
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...
12
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...
10
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...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.