Connecting Tech Pros Worldwide Forums | Help | Site Map

Unicode character conversation

Antimon
Guest
 
Posts: n/a
#1: Mar 21 '06
Hi,

I need to convert a unicode string to ASCII. I can simply use getbytes
method to do that but i would use some characters since Unicode is
16bit.
But i thought there might be some way to convert characters like "ü"
to "u" or, "å" to "a".
Or a chance i can find a conversation table?

Thanks.


the.duckman@gmail.com
Guest
 
Posts: n/a
#2: Mar 22 '06

re: Unicode character conversation


msnd article:
http://msdn.microsoft.com/library/de...classtopic.asp

If your doing this for the sake of calling a legacy dll ther is a
better way.

-dm

the.duckman@gmail.com
Guest
 
Posts: n/a
#3: Mar 22 '06

re: Unicode character conversation


Actuly,

I'd be interested to know if anybody can solve this problem using a
single regular expression.

-dm

Stephany Young
Guest
 
Posts: n/a
#4: Mar 22 '06

re: Unicode character conversation


ASCII is limited to 7 bits being bytes vales 0 to 127 inclusive.

If none of your Unicode characters have a value greater than 255 then you
can use ANSI or UTF8.

If any of your Unicode characters have a value greater than 255 then you are
stuck with using Unicode.


"Antimon" <antimon@gmail.com> wrote in message
news:1142984671.293752.239770@z34g2000cwc.googlegr oups.com...
Hi,

I need to convert a unicode string to ASCII. I can simply use getbytes
method to do that but i would use some characters since Unicode is
16bit.
But i thought there might be some way to convert characters like "ü"
to "u" or, "å" to "a".
Or a chance i can find a conversation table?

Thanks.


Jon Skeet [C# MVP]
Guest
 
Posts: n/a
#5: Mar 22 '06

re: Unicode character conversation


Stephany Young <noone@localhost> wrote:[color=blue]
> ASCII is limited to 7 bits being bytes vales 0 to 127 inclusive.[/color]

Yes.
[color=blue]
> If none of your Unicode characters have a value greater than 255 then you
> can use ANSI or UTF8.
>
> If any of your Unicode characters have a value greater than 255 then you are
> stuck with using Unicode.[/color]

No, not really. For one thing, the various ANSI encodings don't just
map 0-255 to Unicode 0-255 - it's quite possible to have a string which
includes Unicode characters > 255 but which can still be correctly
encoded in a particular ANSI encoding.

Furthermore, UTF-8 can cope with *all* Unicode characters. Non-ASCII
characters are encoded to more than one byte, but they're still encoded
properly...

--
Jon Skeet - <skeet@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
Closed Thread