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

silliest \u question (decimal to unicode)

I have bunch of unicode characters stored as Decimal
is there a easy way of displaying unicode from Decimal numbers or do i have
to convert the decimal to hex then display the hex?
i ran into a small problem with converting Dec to hex and displaying the
hex, because when i do the conversion between Dec and Hex, i dont know how i
can add a \u properly to the result for the compiler to properly recognize
it as a unicode string and not a string with just a \u in it,

i have tried string blah = @"\u" + ConvertToHex(1634); but of course this
will not work because it think its just a string with \u in it and not a
unicode string.

any help would be appreciated
Nov 16 '05 #1
3 6115
Andres A. <fa**@fake.com> wrote:
I have bunch of unicode characters stored as Decimal


Do you mean stored as the decimal type, or as strings in decimal in a
file somewhere?

The integer types themselves are always in binary, effectively -
they're just numbers.

Converting an integer into a unicode character is very simple though:

char c = (char)myInteger;

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 16 '05 #2
Hi Andres,

"Andres A." <fa**@fake.com> wrote in message
news:Po********************@golden.net...
I have bunch of unicode characters stored as Decimal
is there a easy way of displaying unicode from Decimal numbers or do i have to convert the decimal to hex then display the hex?
i ran into a small problem with converting Dec to hex and displaying the
hex, because when i do the conversion between Dec and Hex, i dont know how i can add a \u properly to the result for the compiler to properly recognize
it as a unicode string and not a string with just a \u in it,

i have tried string blah = @"\u" + ConvertToHex(1634); but of course this
will not work because it think its just a string with \u in it and not a
unicode string.

any help would be appreciated


The unicode escape "\u" is only relevant for literal strings (i.e.
quoted string values that are embedded in the code). You can cast directly
from a numeric value (int, long, decimal, etc.) to a char value:

decimal d = 65;
char c = (char)d;

string blah = c.ToString();

Regards,
Daniel
Nov 16 '05 #3
thank you both Jon and Daniel
I was aware that a char is really a integer, but i thought this didnt apply
to unicode characters,
thanks works great now.
"Daniel Pratt" <ko******************@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
Hi Andres,

"Andres A." <fa**@fake.com> wrote in message
news:Po********************@golden.net...
I have bunch of unicode characters stored as Decimal
is there a easy way of displaying unicode from Decimal numbers or do i have
to convert the decimal to hex then display the hex?
i ran into a small problem with converting Dec to hex and displaying the
hex, because when i do the conversion between Dec and Hex, i dont know how i
can add a \u properly to the result for the compiler to properly

recognize it as a unicode string and not a string with just a \u in it,

i have tried string blah = @"\u" + ConvertToHex(1634); but of course this will not work because it think its just a string with \u in it and not a
unicode string.

any help would be appreciated


The unicode escape "\u" is only relevant for literal strings (i.e.
quoted string values that are embedded in the code). You can cast directly
from a numeric value (int, long, decimal, etc.) to a char value:

decimal d = 65;
char c = (char)d;

string blah = c.ToString();

Regards,
Daniel

Nov 16 '05 #4

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

Similar topics

3
by: harrelson | last post by:
I have a list of about 2500 html escape sequences (decimal) that I need to convert to utf-8. Stuff like: 비 행 기 로 보 낼 거
6
by: S. | last post by:
if in my website i am using the sgml { notation, is it accurate to say to my users that the site uses unicode or that it requires unicode? is there a mathematical formula to calculate a unicode...
3
by: Supratim | last post by:
Hi, For past few weeks I am working on a function that would take encoded Unicode characters from query string of http requests and then decode them back to Unicode numbers. I have full success...
5
by: Nancy | last post by:
I recently completed a web page, "Browser Tests of Entities in 2004". http://www.santagata.us/characters/CharacterEntities.html It shows those characters that work in all of the version 5.2+...
1
by: Adam | last post by:
Hello, I'm trying to decifer the data in the table that stores the data in the binary format. All numbers are placed in varbinary fields. All I know is the MS SQL 2000 database useing collation...
6
by: archana | last post by:
Hi all, can someone tell me difference between unicode and utf 8 or utf 18 and which one is supporting more character set. whic i should use to support character ucs-2. I want to use ucs-2...
6
by: Platero | last post by:
Hi, is there a way to convert special characters inserted by a user in a form INTO unicode entities? The output format should be numeric: --->""", not "&apos;". I tried htmlentities and...
8
by: sonald | last post by:
Hi, I am using python2.4.1 I need to pass russian text into python and validate the same. Can u plz guide me on how to make my existing code support the russian text. Is there any module...
3
by: bsagert | last post by:
Some web feeds use decimal character entities that seem to confuse Python (or me). For example, the string "doesn't" may be coded as "doesn’t" which should produce a right leaning apostrophe....
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...
0
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...
0
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,...
0
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...
0
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,...

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.