HighTechTalks DotNet Forums  

utf32 65005 or 12000

Dotnet Internationalization microsoft.public.dotnet.internationalization


Discuss utf32 65005 or 12000 in the Dotnet Internationalization forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
Bob Bins
 
Posts: n/a

Default utf32 65005 or 12000 - 08-07-2007 , 10:20 AM






If you look at the MSDN sample for Encoding.GetEncoding Method (Int32) it
shows the below sample code..
// Get a UTF-32 encoding by codepage.
Encoding e1 = Encoding.GetEncoding( 65005 );

// Get a UTF-32 encoding by name.
Encoding e2 = Encoding.GetEncoding( "utf-32" );

// Check their equality.
Console.WriteLine( "e1 equals e2? {0}", e1.Equals( e2 ) );


The problem is that the first line throws an exception:
System.NotSupportedException Additional information: No data is available
for encoding 65005.

If I look at the code page property when using the "utf-32" string it says
12000.

Which one is correct? Why does the sample show 65005 as utf-32 when the
function thinks 12000 is the utf32 codepage?



Reply With Quote
  #2  
Old   
Mihai N.
 
Posts: n/a

Default Re: utf32 65005 or 12000 - 08-07-2007 , 11:35 PM






Quote:
If you look at the MSDN sample for Encoding.GetEncoding Method (Int32) it
shows the below sample code..
....
Which one is correct? Why does the sample show 65005 as utf-32 when the
function thinks 12000 is the utf32 codepage?
12000 is UTF-32LE (little-endian) and 12001 is UTF-32BE (big-endian),
if you still want to go by codepage.

But I find that getting the encoder by name (or using Encoding.UTF32)
is much more readable than 12000

I tend to use the System.Text.UTF32Encoding, because it gives me control
on byte-endiannes and BOM.


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


Reply With Quote
  #3  
Old   
Bob
 
Posts: n/a

Default Re: utf32 65005 or 12000 - 08-13-2007 , 11:45 AM



So the sample is just a documentation bug/error?

// Get a UTF-32 encoding by codepage.
Encoding e1 = Encoding.GetEncoding( 65005 );

http://msdn2.microsoft.com/en-us/library/wzsz3bk3.aspx


"Mihai N." <nmihai_year_2000 (AT) yahoo (DOT) com> wrote

Quote:
If you look at the MSDN sample for Encoding.GetEncoding Method (Int32) it
shows the below sample code..
...
Which one is correct? Why does the sample show 65005 as utf-32 when the
function thinks 12000 is the utf32 codepage?

12000 is UTF-32LE (little-endian) and 12001 is UTF-32BE (big-endian),
if you still want to go by codepage.

But I find that getting the encoder by name (or using Encoding.UTF32)
is much more readable than 12000

I tend to use the System.Text.UTF32Encoding, because it gives me control
on byte-endiannes and BOM.


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



Reply With Quote
  #4  
Old   
Michael S. Kaplan [MSFT]
 
Posts: n/a

Default Re: utf32 65005 or 12000 - 08-13-2007 , 11:07 PM



Correct.


--
MichKa [Microsoft]
NLS Collation/Locale/Keyboard Technical Lead
Globalization Infrastructure, Fonts, and Tools
Blog: http://blogs.msdn.com/michkap

This posting is provided "AS IS" with
no warranties, and confers no rights.



"Bob" <msgdev (AT) hotmail (DOT) com> wrote

Quote:
So the sample is just a documentation bug/error?

// Get a UTF-32 encoding by codepage.
Encoding e1 = Encoding.GetEncoding( 65005 );

http://msdn2.microsoft.com/en-us/library/wzsz3bk3.aspx


"Mihai N." <nmihai_year_2000 (AT) yahoo (DOT) com> wrote in message
news:Xns9985D18885A6BMihaiN (AT) 207 (DOT) 46.248.16...
If you look at the MSDN sample for Encoding.GetEncoding Method (Int32)
it
shows the below sample code..
...
Which one is correct? Why does the sample show 65005 as utf-32 when the
function thinks 12000 is the utf32 codepage?

12000 is UTF-32LE (little-endian) and 12001 is UTF-32BE (big-endian),
if you still want to go by codepage.

But I find that getting the encoder by name (or using Encoding.UTF32)
is much more readable than 12000

I tend to use the System.Text.UTF32Encoding, because it gives me control
on byte-endiannes and BOM.


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





Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.