Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / New Users / February 2007

Tip: Looking for answers? Try searching our database.

Encoding convertions... optimized two-stage table?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
ThunderMusic - 01 Feb 2007 22:13 GMT
Hi,
   I want to convert UTF-16 (or unicode) to ISO-8859-1...  The .Net
encoding does a pretty code job, but some characters are not converted, like
"O" that becomes "?"...  I want it to become "oe"... So, what I want to know
is the method used by the .NET encoders to convert from one encoding to the
other...  is it using an optimized two-stage table or a multistate table or
other method?

As I know the first 256 characters are the same, it's easy to convert those
256, but for the others, we have to make a correspondance, would an
optimized two-stage table be the best way to go? Does somebody know where I
could get such a table so I don't have to type it all myself?

thanks

ThunderMusic
Jon Skeet [C# MVP] - 01 Feb 2007 22:23 GMT
>     I want to convert UTF-16 (or unicode) to ISO-8859-1...  The .Net
> encoding does a pretty code job, but some characters are not converted, like
> "O" that becomes "?"...  I want it to become "oe"... So, what I want to know
> is the method used by the .NET encoders to convert from one encoding to the
> other...  is it using an optimized two-stage table or a multistate table or
> other method?

Converting from one encoding to another is just a matter of decoding
from a byte array to the Unicode (.NET's "native" UTF-16 format), then
encoding from the Unicode to a byte array.

> As I know the first 256 characters are the same, it's easy to convert those
> 256, but for the others, we have to make a correspondance, would an
> optimized two-stage table be the best way to go? Does somebody know where I
> could get such a table so I don't have to type it all myself?

The process that .NET encodings are using won't help you much,
unfortunately. It sounds like the conversion you need is entirely
within text form - from the combined character to the multi-character
version.

Signature

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

Mihai N. - 01 Feb 2007 23:23 GMT
> I want to convert UTF-16 (or unicode) to ISO-8859-1...  The .Net
> encoding does a pretty code job, but some characters are not converted,
[quoted text clipped - 3 lines]
> other...  is it using an optimized two-stage table or a multistate table or
> other method?

The real solution is to move everything to Unicode, not trying to "squize"
the whole Unicode thru some code page hole with a non-standard,
patchy conversion.

Signature

Mihai Nita [Microsoft MVP, Windows - SDK]
http://www.mihai-nita.net
------------------------------------------
Replace _year_ with _ to get the real email

ThunderMusic - 02 Feb 2007 13:26 GMT
actually, I just seen that the "O" character went wrong in the post (it must
be plain US ASCII), what I wanted to post is the one character "oe"...  and
you just seen that the conversion is not perfect because only the "O" went
through...  Well, I'll try my best anyway...

thanks everyone...

ThunderMusic

>> I want to convert UTF-16 (or unicode) to ISO-8859-1...  The .Net
>> encoding does a pretty code job, but some characters are not converted,
[quoted text clipped - 9 lines]
> the whole Unicode thru some code page hole with a non-standard,
> patchy conversion.

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.