Advertisement
Guest User

all chars in codepage

a guest
Feb 26th, 2018
149
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.07 KB | None | 0 0
  1. private byte[] GetByteArray(int Code, int Len)
  2.         {
  3.             byte[] Ret = new byte[Len];
  4.             byte[] conv = BitConverter.GetBytes(Code);
  5.  
  6.             for (int i = 0; i < Len; i++)
  7.             {
  8.                 Ret[i] = conv[i];
  9.             }
  10.  
  11.             return Ret;
  12.         }
  13.                        ........................
  14.                         int CP = 1251;
  15.                         Encoding enc = Encoding.GetEncoding(CP);
  16.                         int maxbyte = enc.GetMaxByteCount(1);                            
  17.            
  18.                         string[] tbl = new string[maxbyte];
  19.  
  20.                         for (int i = 1; i <= maxbyte; i++)
  21.                         {
  22.                             for (Int64 j = 0; j < int.MaxValue; j++)
  23.                             {
  24.                                 byte[] chrbuf = GetByteArray((int)j, i);
  25.                                 tbl[i]=tbl[i]+enc.GetString(chrbuf);
  26.                             }
  27.                         }
  28.  
  29.                         MessageBox.Show(char.MaxValue.ToString() + " ");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement