[Mono-dev] GBK support error

zhu shi song zhushisongzhu at yahoo.com
Wed Nov 16 03:42:12 EST 2005


Dear Sir,
(1) codepage = GB18030
    String s = "12\u7f51\u9875";
	    
    Encoding e = Encoding.GetEncoding("GB18030");
    byte[] bytebuf = e.GetBytes(s);
	   	    	    
    for ( int i =0; i< bytebuf.Length ; i++) 
       Console.Write("{0:X2}",(byte)bytebuf[i]);
  The result is :
   31328230833582359131
  The correct should be:
   3132CDF8D2B3
(2)codepage = GBK
    String s = "12\u7f51\u9875";
	    
    Encoding e = Encoding.GetEncoding("GBK");
    byte[] bytebuf = e.GetBytes(s);
	   	    	    
    for ( int i =0; i< bytebuf.Length ; i++) 
       Console.Write("{0:X2}",(byte)bytebuf[i]);
  The result is :
  00310032CDF8D2B3
  The correct should be:
   3132CDF8D2B3

  tks
  zhu

--- Atsushi Eno <atsushi at ximian.com> wrote:

> Hi,
> 
> zhu shi song wrote:
> > Dear lists,
> >  I need to convert string "aÓÐÍø" to byte array.
> 
> Can you please give the same string using escaped
> (\uXXXX)
> representation? It looks broken on mail messages.
> 
> >  Encoding e = Encoding.GetEncoding("GBK");	    	  
>    
> >  
> >  byte[] bytebuf = e.GetBytes("1ÓÐÍø");
> > 
> >  Under Windows, I got "31D3D0CDF8". But under
> Mono,
> > the result is "0031D3D0CDF8".
> > 
> > Who can help me?
> > 
> 
> It would be nice if you file a bug on our bugzilla:
> http://www.mono-project.com/Bugs
> 
> Thanks,
> Atsushi Eno
> 


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 



More information about the Mono-devel-list mailing list